20 $this->assertEquals(
$name, $node->getAttribute(
'name'));
21 $this->assertEquals($args, $node->getNode(
'arguments'));
26 $environment =
new Twig_Environment($this->getMockBuilder(
'Twig_LoaderInterface')->getMock());
30 $environment->addFunction(
new Twig_SimpleFunction(
'foobar',
'foobar',
array(
'needs_environment' =>
true,
'needs_context' =>
true)));
31 $environment->addFunction(
new Twig_SimpleFunction(
'barbar',
'twig_tests_function_barbar',
array(
'is_variadic' =>
true)));
36 $tests[] =
array($node,
'foo()', $environment);
39 $tests[] =
array($node,
'foo("bar", "foobar")', $environment);
42 $tests[] =
array($node,
'bar($this->env)', $environment);
45 $tests[] =
array($node,
'bar($this->env, "bar")', $environment);
48 $tests[] =
array($node,
'foofoo($context)', $environment);
51 $tests[] =
array($node,
'foofoo($context, "bar")', $environment);
54 $tests[] =
array($node,
'foobar($this->env, $context)', $environment);
57 $tests[] =
array($node,
'foobar($this->env, $context, "bar")', $environment);
64 $tests[] =
array($node,
'twig_date_converter($this->env, 0, "America/Chicago")');
68 $tests[] =
array($node,
'twig_tests_function_barbar()', $environment);
71 $tests[] =
array($node,
'twig_tests_function_barbar(null, null, array("foo" => "bar"))', $environment);
74 $tests[] =
array($node,
'twig_tests_function_barbar(null, "bar")', $environment);
82 $tests[] =
array($node,
'twig_tests_function_barbar("1", "2", array(0 => "3", "foo" => "bar"))', $environment);
85 if (PHP_VERSION_ID >= 50300) {
87 $tests[] =
array($node,
'call_user_func_array($this->env->getFunction(\'anonymous\')->getCallable(), array("foo"))');
100 if (PHP_VERSION_ID >= 50300) {
101 return include
'PHP53/FunctionInclude.php';
104 return parent::getEnvironment();
Represents a template function.
Represents a node in the AST.
Create styles array
The data for the language used.
Stores the Twig configuration.
twig_tests_function_barbar($arg1=null, $arg2=null, array $args=array())
createFunction($name, array $arguments=array())