4 * This file is part of the Symfony package.
6 * (c) Fabien Potencier <fabien@symfony.com>
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
12 namespace Symfony\Component\ExpressionLanguage\Tests\Node;
14 use Symfony\Component\ExpressionLanguage\Node\ArrayNode;
15 use Symfony\Component\ExpressionLanguage\Node\ConstantNode;
17 class ArrayNodeTest extends AbstractNodeTest
19 public function testSerialization()
21 $node = $this->createArrayNode();
22 $node->addElement(new ConstantNode('foo'));
24 $serializedNode = serialize($node);
25 $unserializedNode = unserialize($serializedNode);
27 $this->assertEquals($node, $unserializedNode);
28 $this->assertNotEquals($this->createArrayNode(), $unserializedNode);
31 public function getEvaluateData()
34 array(array('b' => 'a', 'b'), $this->getArrayNode()),
38 public function getCompileData()
41 array('array("b" => "a", 0 => "b")', $this->getArrayNode()),
45 protected function getArrayNode()
47 $array = $this->createArrayNode();
48 $array->addElement(new ConstantNode('a'), new ConstantNode('b'));
49 $array->addElement(new ConstantNode('b'));
54 protected function createArrayNode()
56 return new ArrayNode();