public function Twig_Tests_Extension_SandboxTest::testMacrosInASandbox 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::testMacrosInASandbox()
File
- vendor/
twig/ twig/ test/ Twig/ Tests/ Extension/ SandboxTest.php, line 164
Class
Code
public function testMacrosInASandbox() {
$twig = $this
->getEnvironment(true, array(
'autoescape' => 'html',
), array(
'index' => <<<EOF
{%- import _self as macros %}
{%- macro test(text) %}<p>{{ text }}</p>{% endmacro %}
{{- macros.test('username') }}
EOF
,
), array(
'macro',
'import',
), array(
'escape',
));
$this
->assertEquals('<p>username</p>', $twig
->loadTemplate('index')
->render(array()));
}