public function TwigRawTest::testAutoescapeRaw in Drupal 10
Same name and namespace in other branches
- 8 core/modules/system/tests/src/Kernel/Theme/TwigRawTest.php \Drupal\Tests\system\Kernel\Theme\TwigRawTest::testAutoescapeRaw()
- 9 core/modules/system/tests/src/Kernel/Theme/TwigRawTest.php \Drupal\Tests\system\Kernel\Theme\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>');
}