protected function TwigSandboxTest::setUp in Drupal 9
Same name and namespace in other branches
- 8 core/tests/Drupal/Tests/Core/Template/TwigSandboxTest.php \Drupal\Tests\Core\Template\TwigSandboxTest::setUp()
Overrides UnitTestCase::setUp
File
- core/
tests/ Drupal/ Tests/ Core/ Template/ TwigSandboxTest.php, line 37 - Contains \Drupal\Tests\Core\Template\TwigSandboxTest.
Class
- TwigSandboxTest
- Tests the twig sandbox policy.
Namespace
Drupal\Tests\Core\TemplateCode
protected function setUp() : void {
parent::setUp();
$loader = new StringLoader();
$this->twig = new Environment($loader);
$policy = new TwigSandboxPolicy();
$sandbox = new SandboxExtension($policy, TRUE);
$this->twig
->addExtension($sandbox);
}