UnaryNodeTest.php 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. <?php
  2. /*
  3. * This file is part of the Symfony package.
  4. *
  5. * (c) Fabien Potencier <fabien@symfony.com>
  6. *
  7. * For the full copyright and license information, please view the LICENSE
  8. * file that was distributed with this source code.
  9. */
  10. namespace Symfony\Component\ExpressionLanguage\Tests\Node;
  11. use Symfony\Component\ExpressionLanguage\Node\ConstantNode;
  12. use Symfony\Component\ExpressionLanguage\Node\UnaryNode;
  13. class UnaryNodeTest extends AbstractNodeTest
  14. {
  15. public function getEvaluateData()
  16. {
  17. return [
  18. [-1, new UnaryNode('-', new ConstantNode(1))],
  19. [3, new UnaryNode('+', new ConstantNode(3))],
  20. [false, new UnaryNode('!', new ConstantNode(true))],
  21. [false, new UnaryNode('not', new ConstantNode(true))],
  22. ];
  23. }
  24. public function getCompileData()
  25. {
  26. return [
  27. ['(-1)', new UnaryNode('-', new ConstantNode(1))],
  28. ['(+3)', new UnaryNode('+', new ConstantNode(3))],
  29. ['(!true)', new UnaryNode('!', new ConstantNode(true))],
  30. ['(!true)', new UnaryNode('not', new ConstantNode(true))],
  31. ];
  32. }
  33. public function getDumpData()
  34. {
  35. return [
  36. ['(- 1)', new UnaryNode('-', new ConstantNode(1))],
  37. ['(+ 3)', new UnaryNode('+', new ConstantNode(3))],
  38. ['(! true)', new UnaryNode('!', new ConstantNode(true))],
  39. ['(not true)', new UnaryNode('not', new ConstantNode(true))],
  40. ];
  41. }
  42. }