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 |
Reimplemented from Twig_Test_NodeTestCase.
Definition at line 98 of file FunctionTest.php.
99 {
100 if (PHP_VERSION_ID >= 50300) {
101 return include 'PHP53/FunctionInclude.php';
102 }
103
104 return parent::getEnvironment();
105 }
◆ getTests()
Twig_Tests_Node_Expression_FunctionTest::getTests |
( |
| ) |
|
Reimplemented from Twig_Test_NodeTestCase.
Definition at line 24 of file FunctionTest.php.
25 {
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)));
32
34
36 $tests[] = array($node,
'foo()', $environment);
37
39 $tests[] = array($node,
'foo("bar", "foobar")', $environment);
40
42 $tests[] = array($node,
'bar($this->env)', $environment);
43
45 $tests[] = array($node,
'bar($this->env, "bar")', $environment);
46
48 $tests[] = array($node,
'foofoo($context)', $environment);
49
51 $tests[] = array($node,
'foofoo($context, "bar")', $environment);
52
54 $tests[] = array($node,
'foobar($this->env, $context)', $environment);
55
57 $tests[] = array($node,
'foobar($this->env, $context, "bar")', $environment);
58
59
63 ));
64 $tests[] = array($node,
'twig_date_converter($this->env, 0, "America/Chicago")');
65
66
68 $tests[] = array($node,
'twig_tests_function_barbar()', $environment);
69
71 $tests[] = array($node,
'twig_tests_function_barbar(null, null, array("foo" => "bar"))', $environment);
72
74 $tests[] = array($node,
'twig_tests_function_barbar(null, "bar")', $environment);
75
81 ));
82 $tests[] = array($node,
'twig_tests_function_barbar("1", "2", array(0 => "3", "foo" => "bar"))', $environment);
83
84
85 if (PHP_VERSION_ID >= 50300) {
87 $tests[] = array($node,
'call_user_func_array($this->env->getFunction(\'anonymous\')->getCallable(), array("foo"))');
88 }
89
91 }
Stores the Twig configuration.
Represents a template function.
createFunction($name, array $arguments=array())
References $tests, and createFunction().
◆ testConstructor()
Twig_Tests_Node_Expression_FunctionTest::testConstructor |
( |
| ) |
|
Definition at line 14 of file FunctionTest.php.
15 {
19
20 $this->assertEquals(
$name, $node->getAttribute(
'name'));
21 $this->assertEquals($args, $node->getNode('arguments'));
22 }
References $name.
The documentation for this class was generated from the following file: