Version 1
[yaffs-website] / vendor / symfony / expression-language / Tests / Node / FunctionNodeTest.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 Symfony\Component\ExpressionLanguage\Node\FunctionNode;
15 use Symfony\Component\ExpressionLanguage\Node\ConstantNode;
16 use Symfony\Component\ExpressionLanguage\Node\Node;
17
18 class FunctionNodeTest extends AbstractNodeTest
19 {
20     public function getEvaluateData()
21     {
22         return array(
23             array('bar', new FunctionNode('foo', new Node(array(new ConstantNode('bar')))), array(), array('foo' => $this->getCallables())),
24         );
25     }
26
27     public function getCompileData()
28     {
29         return array(
30             array('foo("bar")', new FunctionNode('foo', new Node(array(new ConstantNode('bar')))), array('foo' => $this->getCallables())),
31         );
32     }
33
34     protected function getCallables()
35     {
36         return array(
37             'compiler' => function ($arg) {
38                 return sprintf('foo(%s)', $arg);
39             },
40             'evaluator' => function ($variables, $arg) {
41                 return $arg;
42             },
43         );
44     }
45 }