18 public function testCompile($node, $source, $environment = null)
26 $compiler->compile($node);
28 $this->assertEquals($source, trim($compiler->getSource()));
43 if (version_compare(phpversion(),
'5.4.0RC1',
'>=')) {
44 return sprintf(
'(isset($context["%s"]) ? $context["%s"] : null)', $name, $name);
47 return sprintf(
'$this->getContext($context, "%s")', $name);
52 if (function_exists(
'twig_template_get_attributes')) {
53 return 'twig_template_get_attributes($this, ';
56 return '$this->getAttribute(';
Compiles a node to PHP code.
assertNodeCompilation($source, Twig_Node $node, Twig_Environment $environment=null)
Represents a node in the AST.
testCompile($node, $source, $environment=null)
getTests
getCompiler(Twig_Environment $environment=null)
Stores the Twig configuration.