protected function Twig_Tests_Extension_SandboxTest::getEnvironment in Zircon Profile 8.0
Same name and namespace in other branches
- 8 vendor/twig/twig/test/Twig/Tests/Extension/SandboxTest.php \Twig_Tests_Extension_SandboxTest::getEnvironment()
4 calls to Twig_Tests_Extension_SandboxTest::getEnvironment()
- Twig_Tests_Extension_SandboxTest::testMacrosInASandbox in vendor/
twig/ twig/ test/ Twig/ Tests/ Extension/ SandboxTest.php - Twig_Tests_Extension_SandboxTest::testSandboxGloballySet in vendor/
twig/ twig/ test/ Twig/ Tests/ Extension/ SandboxTest.php - Twig_Tests_Extension_SandboxTest::testSandboxLocallySetForAnInclude in vendor/
twig/ twig/ test/ Twig/ Tests/ Extension/ SandboxTest.php - Twig_Tests_Extension_SandboxTest::testSandboxWithInheritance in vendor/
twig/ twig/ test/ Twig/ Tests/ Extension/ SandboxTest.php - @expectedException Twig_Sandbox_SecurityError @expectedExceptionMessage Filter "json_encode" is not allowed in "1_child" at line 3.
File
- vendor/
twig/ twig/ test/ Twig/ Tests/ Extension/ SandboxTest.php, line 178
Class
Code
protected function getEnvironment($sandboxed, $options, $templates, $tags = array(), $filters = array(), $methods = array(), $properties = array(), $functions = array()) {
$loader = new Twig_Loader_Array($templates);
$twig = new Twig_Environment($loader, array_merge(array(
'debug' => true,
'cache' => false,
'autoescape' => false,
), $options));
$policy = new Twig_Sandbox_SecurityPolicy($tags, $filters, $methods, $properties, $functions);
$twig
->addExtension(new Twig_Extension_Sandbox($policy, $sandboxed));
return $twig;
}