You are here

public function GeshiFilterCssTest::testCssExternal 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::testCssExternal()

Test the css when CSS mode for syntax highlighting is external managed.

In this case we have both geshifilter.css and geshi-languages.css.

File

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

Class

GeshiFilterCssTest
Test for css generation and use in GeshiFilter.

Namespace

Drupal\Tests\geshifilter\Functional

Code

public function testCssExternal() {

  // Node Content.
  $node = [
    'title' => 'Test for GeShi Filter',
    'body' => [
      [
        'value' => "dfgdfg <code language=\"php\">echo(\"hi\");</code> dfgdg",
        'format' => 'geshifilter_text_format',
      ],
    ],
    'type' => 'geshifilter_content_type',
  ];

  // External managed CSS.
  $form_values = [
    'css_mode' => 2,
  ];
  $this
    ->drupalPostForm('admin/config/content/formats/geshifilter', $form_values, t('Save configuration'));

  // Create the node and read it.
  $this
    ->drupalCreateNode($node);
  $this
    ->drupalGet('node/1');

  // Test if we have both css.
  $this
    ->assertRaw('/assets/css/geshifilter.css', 'The CSS file /assets/css/geshifilter.css is present.');
  $this
    ->assertRaw('/geshi/geshifilter-languages.css', 'The CSS file /geshi/geshifilter-languages.css is present.');
}