public function GeshiFilterTest::testSpecialChars in GeSHi Filter for syntax highlighting 8
Same name and namespace in other branches
- 8.2 tests/src/Functional/GeshiFilterTest.php \Drupal\Tests\geshifilter\Functional\GeshiFilterTest::testSpecialChars()
Issue https://www.drupal.org/node/2047021.
File
- tests/src/ Functional/ GeshiFilterTest.php, line 524 
Class
- GeshiFilterTest
- Tests for GeshiFilter in node content.
Namespace
Drupal\Tests\geshifilter\FunctionalCode
public function testSpecialChars() {
  $this->config
    ->set('tags', 'code');
  $this->config
    ->set('language.php.enabled', TRUE);
  $this->config
    ->set('decode_entities', TRUE);
  $this->config
    ->save();
  $source = '<code language="php"><?php echo("<b>Hi</b>"); ?></code>';
  // Create a node.
  $node = [
    'title' => 'Test for Custom Filter',
    'body' => [
      [
        'value' => $source,
        'format' => 'geshifilter_text_format',
      ],
    ],
    'type' => 'geshifilter_content_type',
  ];
  $this
    ->drupalCreateNode($node);
  $this
    ->drupalGet('node/1');
  // The same string must be on page, not double encoded.
  $this
    ->assertRaw('"<b>Hi</b>"', 'The code is not double encoded.');
}