public function Twig_Tests_Extension_SandboxTest::testMacrosInASandbox

File

drupal/core/vendor/twig/twig/test/Twig/Tests/Extension/SandboxTest.php, line 156

Class

Twig_Tests_Extension_SandboxTest

Code

public function testMacrosInASandbox() {
  $twig = $this
    ->getEnvironment(true, array(
    'autoescape' => true,
  ), array(
    'index' => <<<EOF
{% macro test(text) %}<p>{{ text }}</p>{% endmacro %}
{{ _self.test('username') }}
EOF
,
  ), array(
    'macro',
  ), array(
    'escape',
  ));
  $this
    ->assertEquals('<p>username</p>', $twig
    ->loadTemplate('index')
    ->render(array()));
}