You are here

public function GeshiFilterAdministrationTest::setUp in GeSHi Filter for syntax highlighting 8

Same name and namespace in other branches
  1. 8.2 tests/src/Functional/GeshiFilterAdministrationTest.php \Drupal\Tests\geshifilter\Functional\GeshiFilterAdministrationTest::setUp()

Set up the tests and create the users.

Overrides BrowserTestBase::setUp

File

tests/src/Functional/GeshiFilterAdministrationTest.php, line 48

Class

GeshiFilterAdministrationTest
Test for administrative interface of GeshiFilter.

Namespace

Drupal\Tests\geshifilter\Functional

Code

public function setUp() {
  parent::setUp();

  // Create object with configuration.
  $this->config = \Drupal::configFactory()
    ->getEditable('geshifilter.settings');

  // Create a filter admin user.
  $permissions = [
    'administer filters',
    'access administration pages',
    'administer site configuration',
  ];
  $this->filterAdminUser = $this
    ->drupalCreateUser($permissions);

  // Log in with filter admin user.
  $this
    ->drupalLogin($this->filterAdminUser);

  // Add a text format with only geshifilter
  // $this->createTextFormat('geshifilter_text_format',
  // array('filter_geshifilter'));.
  // Set some default GeSHi filter admin settings.
  // Set default highlighting mode to "do nothing".
  $this->config
    ->set('default_highlighting', GeshiFilter::DEFAULT_PLAINTEXT);
  $this->config
    ->set('use_format_specific_options', FALSE);
  $this->config
    ->set('tag_styles', [
    GeshiFilter::BRACKETS_ANGLE => GeshiFilter::BRACKETS_ANGLE,
    GeshiFilter::BRACKETS_SQUARE => GeshiFilter::BRACKETS_SQUARE,
  ]);
  $this->config
    ->set('default_line_numbering', GeshiFilter::LINE_NUMBERS_DEFAULT_NONE);
  $this->config
    ->save();
}