]>
Commit | Line | Data |
---|---|---|
4f5b44bd NL |
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_Binary_OrTest extends Twig_Test_NodeTestCase | |
13 | { | |
14 | /** | |
15 | * @covers Twig_Node_Expression_Binary_Or::__construct | |
16 | */ | |
17 | public function testConstructor() | |
18 | { | |
19 | $left = new Twig_Node_Expression_Constant(1, 1); | |
20 | $right = new Twig_Node_Expression_Constant(2, 1); | |
21 | $node = new Twig_Node_Expression_Binary_Or($left, $right, 1); | |
22 | ||
23 | $this->assertEquals($left, $node->getNode('left')); | |
24 | $this->assertEquals($right, $node->getNode('right')); | |
25 | } | |
26 | ||
27 | /** | |
28 | * @covers Twig_Node_Expression_Binary_Or::compile | |
29 | * @covers Twig_Node_Expression_Binary_Or::operator | |
30 | * @dataProvider getTests | |
31 | */ | |
32 | public function testCompile($node, $source, $environment = null) | |
33 | { | |
34 | parent::testCompile($node, $source, $environment); | |
35 | } | |
36 | ||
37 | public function getTests() | |
38 | { | |
39 | $left = new Twig_Node_Expression_Constant(1, 1); | |
40 | $right = new Twig_Node_Expression_Constant(2, 1); | |
41 | $node = new Twig_Node_Expression_Binary_Or($left, $right, 1); | |
42 | ||
43 | return array( | |
44 | array($node, '(1 || 2)'), | |
45 | ); | |
46 | } | |
47 | } |