You are here

public function Twig_Tests_Node_IfTest::testConstructor in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 vendor/twig/twig/test/Twig/Tests/Node/IfTest.php \Twig_Tests_Node_IfTest::testConstructor()

File

vendor/twig/twig/test/Twig/Tests/Node/IfTest.php, line 14

Class

Twig_Tests_Node_IfTest

Code

public function testConstructor() {
  $t = new Twig_Node(array(
    new Twig_Node_Expression_Constant(true, 1),
    new Twig_Node_Print(new Twig_Node_Expression_Name('foo', 1), 1),
  ), array(), 1);
  $else = null;
  $node = new Twig_Node_If($t, $else, 1);
  $this
    ->assertEquals($t, $node
    ->getNode('tests'));
  $this
    ->assertNull($node
    ->getNode('else'));
  $else = new Twig_Node_Print(new Twig_Node_Expression_Name('bar', 1), 1);
  $node = new Twig_Node_If($t, $else, 1);
  $this
    ->assertEquals($else, $node
    ->getNode('else'));
}