BlockReferenceTest.php 977B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  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_BlockReferenceTest extends Twig_Test_NodeTestCase
  11. {
  12. /**
  13. * @covers Twig_Node_BlockReference::__construct
  14. */
  15. public function testConstructor()
  16. {
  17. $node = new Twig_Node_BlockReference('foo', 1);
  18. $this->assertEquals('foo', $node->getAttribute('name'));
  19. }
  20. /**
  21. * @covers Twig_Node_BlockReference::compile
  22. * @dataProvider getTests
  23. */
  24. public function testCompile($node, $source, $environment = null)
  25. {
  26. parent::testCompile($node, $source, $environment);
  27. }
  28. public function getTests()
  29. {
  30. return array(
  31. array(new Twig_Node_BlockReference('foo', 1), <<<EOF
  32. // line 1
  33. \$this->displayBlock('foo', \$context, \$blocks);
  34. EOF
  35. ),
  36. );
  37. }
  38. }