AbstractNodeTest.php 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  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 PHPUnit\Framework\TestCase;
  12. use Symfony\Component\ExpressionLanguage\Compiler;
  13. abstract class AbstractNodeTest extends TestCase
  14. {
  15. /**
  16. * @dataProvider getEvaluateData
  17. */
  18. public function testEvaluate($expected, $node, $variables = [], $functions = [])
  19. {
  20. $this->assertSame($expected, $node->evaluate($functions, $variables));
  21. }
  22. abstract public function getEvaluateData();
  23. /**
  24. * @dataProvider getCompileData
  25. */
  26. public function testCompile($expected, $node, $functions = [])
  27. {
  28. $compiler = new Compiler($functions);
  29. $node->compile($compiler);
  30. $this->assertSame($expected, $compiler->getSource());
  31. }
  32. abstract public function getCompileData();
  33. /**
  34. * @dataProvider getDumpData
  35. */
  36. public function testDump($expected, $node)
  37. {
  38. $this->assertSame($expected, $node->dump());
  39. }
  40. abstract public function getDumpData();
  41. }