0f35b5febe8e2168df93069fe719c16ec2a1b057
[yaffs-website] / vendor / symfony / expression-language / Tests / Node / NodeTest.php
1 <?php
2
3 /*
4  * This file is part of the Symfony package.
5  *
6  * (c) Fabien Potencier <fabien@symfony.com>
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 namespace Symfony\Component\ExpressionLanguage\Tests\Node;
13
14 use PHPUnit\Framework\TestCase;
15 use Symfony\Component\ExpressionLanguage\Node\Node;
16 use Symfony\Component\ExpressionLanguage\Node\ConstantNode;
17
18 class NodeTest extends TestCase
19 {
20     public function testToString()
21     {
22         $node = new Node(array(new ConstantNode('foo')));
23
24         $this->assertEquals(<<<'EOF'
25 Node(
26     ConstantNode(value: 'foo')
27 )
28 EOF
29         , (string) $node);
30     }
31
32     public function testSerialization()
33     {
34         $node = new Node(array('foo' => 'bar'), array('bar' => 'foo'));
35
36         $serializedNode = serialize($node);
37         $unserializedNode = unserialize($serializedNode);
38
39         $this->assertEquals($node, $unserializedNode);
40     }
41 }