You are here

public function TwigRawTest::testAutoescapeRaw in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/system/src/Tests/Theme/TwigRawTest.php \Drupal\system\Tests\Theme\TwigRawTest::testAutoescapeRaw()

Tests the raw filter inside an autoescape tag.

File

core/modules/system/src/Tests/Theme/TwigRawTest.php, line 29
Contains \Drupal\system\Tests\Theme\TwigRawTest.

Class

TwigRawTest
Tests Twig 'raw' filter.

Namespace

Drupal\system\Tests\Theme

Code

public function testAutoescapeRaw() {
  $test = array(
    '#theme' => 'twig_raw_test',
    '#script' => '<script>alert("This alert is real because I will put it through the raw filter!");</script>',
  );
  $rendered = \Drupal::service('renderer')
    ->renderRoot($test);
  $this
    ->setRawContent($rendered);
  $this
    ->assertRaw('<script>alert("This alert is real because I will put it through the raw filter!");</script>');
}