function TwigRawTest::testAutoescapeRaw
Tests the raw filter inside an autoescape tag.
File
- 
              core/modules/ system/ tests/ src/ Kernel/ Theme/ TwigRawTest.php, line 24 
Class
- TwigRawTest
- Tests Twig 'raw' filter.
Namespace
Drupal\Tests\system\Kernel\ThemeCode
public function testAutoescapeRaw() {
  $test = [
    '#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>');
}Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.
