You are here

public function GeshiFilterTest::testSquareBracketConfusion in GeSHi Filter for syntax highlighting 8

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

Issue http://drupal.org/node/1010216.

File

tests/src/Functional/GeshiFilterTest.php, line 503

Class

GeshiFilterTest
Tests for GeshiFilter in node content.

Namespace

Drupal\Tests\geshifilter\Functional

Code

public function testSquareBracketConfusion() {
  $this->config
    ->set('tags', 'code');
  $this->config
    ->set('language.ini.enabled', TRUE);
  $source_code = "[section]\nserver=192.0.2.62  ; IP address\nport=12345";

  // Enable square brackets.
  $this->config
    ->set('tag_styles', [
    GeshiFilter::BRACKETS_SQUARE => GeshiFilter::BRACKETS_SQUARE,
  ]);
  $this->config
    ->save();

  // This should be filtered.
  $this
    ->assertGeshiFilterHighlighting('[code]' . $source_code . '[/code]', [
    [
      $source_code,
      'text',
      0,
      1,
      FALSE,
    ],
  ], t('Checking if [code][section]...[/code] works'));
  $this
    ->assertGeshiFilterHighlighting('[code language="ini"]' . $source_code . '[/code]', [
    [
      $source_code,
      'ini',
      0,
      1,
      FALSE,
    ],
  ], t('Checking if [code language="ini"][section]...[/code] works'));
}