You are here

protected function TwigSandboxTest::setUp in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 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 33
Contains \Drupal\Tests\Core\Template\TwigSandboxTest.

Class

TwigSandboxTest
Tests the twig sandbox policy.

Namespace

Drupal\Tests\Core\Template

Code

protected function setUp() {
  parent::setUp();
  $loader = new StringLoader();
  $this->twig = new \Twig_Environment($loader);
  $policy = new TwigSandboxPolicy();
  $sandbox = new \Twig_Extension_Sandbox($policy, TRUE);
  $this->twig
    ->addExtension($sandbox);
}