'twig_raw_test', '#script' => '', ]; $rendered = \Drupal::service('renderer')->renderRoot($test); $this->setRawContent($rendered); $this->assertRaw(''); } /** * Tests autoescaping of unsafe content. * * This is one of the most important tests in Drupal itself in terms of * security. */ public function testAutoescape() { $script = ''; $build = [ '#theme' => 'twig_autoescape_test', '#script' => $script, ]; $rendered = \Drupal::service('renderer')->renderRoot($build); $this->setRawContent($rendered); $this->assertEscaped($script); } }