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 12use Twig\Node\Expression\ArrayExpression; 13use Twig\Node\Expression\ConstantExpression; 14use Twig\Test\NodeTestCase; 15 16class Twig_Tests_Node_Expression_ArrayTest extends NodeTestCase 17{ 18 public function testConstructor() 19 { 20 $elements = [new ConstantExpression('foo', 1), $foo = new ConstantExpression('bar', 1)]; 21 $node = new ArrayExpression($elements, 1); 22 23 $this->assertEquals($foo, $node->getNode(1)); 24 } 25 26 public function getTests() 27 { 28 $elements = [ 29 new ConstantExpression('foo', 1), 30 new ConstantExpression('bar', 1), 31 32 new ConstantExpression('bar', 1), 33 new ConstantExpression('foo', 1), 34 ]; 35 $node = new ArrayExpression($elements, 1); 36 37 return [ 38 [$node, '["foo" => "bar", "bar" => "foo"]'], 39 ]; 40 } 41} 42