assertEquals($t, $node->getNode('tests')); $this->assertFalse($node->hasNode('else')); $else = new PrintNode(new NameExpression('bar', 1), 1); $node = new IfNode($t, $else, 1); $this->assertEquals($else, $node->getNode('else')); } public function getTests() { $tests = []; $t = new Node([ new ConstantExpression(true, 1), new PrintNode(new NameExpression('foo', 1), 1), ], [], 1); $else = null; $node = new IfNode($t, $else, 1); $tests[] = [$node, <<getVariableGetter('foo')}; } EOF ]; $t = new Node([ new ConstantExpression(true, 1), new PrintNode(new NameExpression('foo', 1), 1), new ConstantExpression(false, 1), new PrintNode(new NameExpression('bar', 1), 1), ], [], 1); $else = null; $node = new IfNode($t, $else, 1); $tests[] = [$node, <<getVariableGetter('foo')}; } elseif (false) { echo {$this->getVariableGetter('bar')}; } EOF ]; $t = new Node([ new ConstantExpression(true, 1), new PrintNode(new NameExpression('foo', 1), 1), ], [], 1); $else = new PrintNode(new NameExpression('bar', 1), 1); $node = new IfNode($t, $else, 1); $tests[] = [$node, <<getVariableGetter('foo')}; } else { echo {$this->getVariableGetter('bar')}; } EOF ]; return $tests; } }