diff options
Diffstat (limited to 'vendor/twig/twig/test/Twig/Tests/Node/Expression/TestTest.php')
-rw-r--r-- | vendor/twig/twig/test/Twig/Tests/Node/Expression/TestTest.php | 68 |
1 files changed, 0 insertions, 68 deletions
diff --git a/vendor/twig/twig/test/Twig/Tests/Node/Expression/TestTest.php b/vendor/twig/twig/test/Twig/Tests/Node/Expression/TestTest.php deleted file mode 100644 index 0664150a..00000000 --- a/vendor/twig/twig/test/Twig/Tests/Node/Expression/TestTest.php +++ /dev/null | |||
@@ -1,68 +0,0 @@ | |||
1 | <?php | ||
2 | |||
3 | /* | ||
4 | * This file is part of Twig. | ||
5 | * | ||
6 | * (c) Fabien Potencier | ||
7 | * | ||
8 | * For the full copyright and license information, please view the LICENSE | ||
9 | * file that was distributed with this source code. | ||
10 | */ | ||
11 | |||
12 | class Twig_Tests_Node_Expression_TestTest extends Twig_Test_NodeTestCase | ||
13 | { | ||
14 | /** | ||
15 | * @covers Twig_Node_Expression_Test::__construct | ||
16 | */ | ||
17 | public function testConstructor() | ||
18 | { | ||
19 | $expr = new Twig_Node_Expression_Constant('foo', 1); | ||
20 | $name = new Twig_Node_Expression_Constant('null', 1); | ||
21 | $args = new Twig_Node(); | ||
22 | $node = new Twig_Node_Expression_Test($expr, $name, $args, 1); | ||
23 | |||
24 | $this->assertEquals($expr, $node->getNode('node')); | ||
25 | $this->assertEquals($args, $node->getNode('arguments')); | ||
26 | $this->assertEquals($name, $node->getAttribute('name')); | ||
27 | } | ||
28 | |||
29 | /** | ||
30 | * @covers Twig_Node_Expression_Test::compile | ||
31 | * @dataProvider getTests | ||
32 | */ | ||
33 | public function testCompile($node, $source, $environment = null) | ||
34 | { | ||
35 | parent::testCompile($node, $source, $environment); | ||
36 | } | ||
37 | |||
38 | public function getTests() | ||
39 | { | ||
40 | $tests = array(); | ||
41 | |||
42 | $expr = new Twig_Node_Expression_Constant('foo', 1); | ||
43 | $node = new Twig_Node_Expression_Test_Null($expr, 'null', new Twig_Node(array()), 1); | ||
44 | $tests[] = array($node, '(null === "foo")'); | ||
45 | |||
46 | // test as an anonymous function | ||
47 | if (version_compare(phpversion(), '5.3.0', '>=')) { | ||
48 | $node = $this->createTest(new Twig_Node_Expression_Constant('foo', 1), 'anonymous', array(new Twig_Node_Expression_Constant('foo', 1))); | ||
49 | $tests[] = array($node, 'call_user_func_array($this->env->getTest(\'anonymous\')->getCallable(), array("foo", "foo"))'); | ||
50 | } | ||
51 | |||
52 | return $tests; | ||
53 | } | ||
54 | |||
55 | protected function createTest($node, $name, array $arguments = array()) | ||
56 | { | ||
57 | return new Twig_Node_Expression_Test($node, $name, new Twig_Node($arguments), 1); | ||
58 | } | ||
59 | |||
60 | protected function getEnvironment() | ||
61 | { | ||
62 | if (version_compare(phpversion(), '5.3.0', '>=')) { | ||
63 | return include 'PHP53/TestInclude.php'; | ||
64 | } | ||
65 | |||
66 | return parent::getEnvironment(); | ||
67 | } | ||
68 | } | ||