You are here

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

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

Set up the tests and create the users.

Overrides BrowserTestBase::setUp

File

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

Class

GeshiFilterCssTest
Test for css generation and use in GeshiFilter.

Namespace

Drupal\Tests\geshifilter\Functional

Code

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

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

  // And set the path to the geshi library.
  $this->config
    ->set('geshi_dir', '/libraries/geshi');
  $settings = [
    // Override default type (a random name).
    'type' => 'geshifilter_content_type',
    'name' => 'Geshifilter Content',
  ];
  $this
    ->drupalCreateContentType($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 an text format with only geshi filter.
  $this
    ->createTextFormat('geshifilter_text_format', [
    'filter_geshifilter',
  ]);
}