Definition at line 12 of file FunctionTest.php.
◆ createFunction()
Twig_Tests_Node_Expression_FunctionTest::createFunction |
( |
|
$name, |
|
|
array |
$arguments = array() |
|
) |
| |
|
protected |
◆ getEnvironment()
Twig_Tests_Node_Expression_FunctionTest::getEnvironment |
( |
| ) |
|
|
protected |
Definition at line 98 of file FunctionTest.php.
100 if (PHP_VERSION_ID >= 50300) {
101 return include
'PHP53/FunctionInclude.php';
104 return parent::getEnvironment();
◆ getTests()
Twig_Tests_Node_Expression_FunctionTest::getTests |
( |
| ) |
|
Definition at line 24 of file FunctionTest.php.
References $tests, and createFunction().
26 $environment =
new Twig_Environment($this->getMockBuilder(
'Twig_LoaderInterface')->getMock());
28 $environment->addFunction(
new Twig_SimpleFunction(
'bar',
'bar', array(
'needs_environment' =>
true)));
29 $environment->addFunction(
new Twig_SimpleFunction(
'foofoo',
'foofoo', array(
'needs_context' =>
true)));
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"))');
Represents a template function.
Stores the Twig configuration.
createFunction($name, array $arguments=array())
◆ testConstructor()
Twig_Tests_Node_Expression_FunctionTest::testConstructor |
( |
| ) |
|
Definition at line 14 of file FunctionTest.php.
References $name.
20 $this->assertEquals(
$name, $node->getAttribute(
'name'));
21 $this->assertEquals($args, $node->getNode(
'arguments'));
Represents a node in the AST.
The documentation for this class was generated from the following file: