PrintTest.php 993B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. <?php
  2. /*
  3. * This file is part of Twig.
  4. *
  5. * (c) Fabien Potencier
  6. *
  7. * For the full copyright and license information, please view the LICENSE
  8. * file that was distributed with this source code.
  9. */
  10. class Twig_Tests_Node_PrintTest extends Twig_Test_NodeTestCase
  11. {
  12. /**
  13. * @covers Twig_Node_Print::__construct
  14. */
  15. public function testConstructor()
  16. {
  17. $expr = new Twig_Node_Expression_Constant('foo', 1);
  18. $node = new Twig_Node_Print($expr, 1);
  19. $this->assertEquals($expr, $node->getNode('expr'));
  20. }
  21. /**
  22. * @covers Twig_Node_Print::compile
  23. * @dataProvider getTests
  24. */
  25. public function testCompile($node, $source, $environment = null)
  26. {
  27. parent::testCompile($node, $source, $environment);
  28. }
  29. public function getTests()
  30. {
  31. $tests = array();
  32. $tests[] = array(new Twig_Node_Print(new Twig_Node_Expression_Constant('foo', 1), 1), "// line 1\necho \"foo\";");
  33. return $tests;
  34. }
  35. }