DoTest.php 1.0KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  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. require_once dirname(__FILE__).'/TestCase.php';
  11. class Twig_Tests_Node_DoTest extends Twig_Tests_Node_TestCase
  12. {
  13. /**
  14. * @covers Twig_Node_Do::__construct
  15. */
  16. public function testConstructor()
  17. {
  18. $expr = new Twig_Node_Expression_Constant('foo', 0);
  19. $node = new Twig_Node_Do($expr, 0);
  20. $this->assertEquals($expr, $node->getNode('expr'));
  21. }
  22. /**
  23. * @covers Twig_Node_Do::compile
  24. * @dataProvider getTests
  25. */
  26. public function testCompile($node, $source, $environment = null)
  27. {
  28. parent::testCompile($node, $source, $environment);
  29. }
  30. public function getTests()
  31. {
  32. $tests = array();
  33. $expr = new Twig_Node_Expression_Constant('foo', 0);
  34. $node = new Twig_Node_Do($expr, 0);
  35. $tests[] = array($node, '"foo";');
  36. return $tests;
  37. }
  38. }