AutoEscapeTest.php 1.1KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  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_AutoEscapeTest extends Twig_Test_NodeTestCase
  11. {
  12. /**
  13. * @covers Twig_Node_AutoEscape::__construct
  14. */
  15. public function testConstructor()
  16. {
  17. $body = new Twig_Node(array(new Twig_Node_Text('foo', 1)));
  18. $node = new Twig_Node_AutoEscape(true, $body, 1);
  19. $this->assertEquals($body, $node->getNode('body'));
  20. $this->assertEquals(true, $node->getAttribute('value'));
  21. }
  22. /**
  23. * @covers Twig_Node_AutoEscape::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. $body = new Twig_Node(array(new Twig_Node_Text('foo', 1)));
  33. $node = new Twig_Node_AutoEscape(true, $body, 1);
  34. return array(
  35. array($node, "// line 1\necho \"foo\";"),
  36. );
  37. }
  38. }