PhpRendererTest.php 1.1 KB

12345678910111213141516171819202122232425262728293031
  1. <?php
  2. /*
  3. * This file is part of the Symfony package.
  4. *
  5. * (c) Fabien Potencier <fabien.potencier@symfony-project.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\Tests\Component\Templating\Renderer;
  11. use Symfony\Component\Templating\Renderer\PhpRenderer;
  12. use Symfony\Component\Templating\Storage\Storage;
  13. use Symfony\Component\Templating\Storage\StringStorage;
  14. use Symfony\Component\Templating\Storage\FileStorage;
  15. class PhpRendererTest extends \PHPUnit_Framework_TestCase
  16. {
  17. public function testEvaluate()
  18. {
  19. $renderer = new PhpRenderer();
  20. $template = new StringStorage('<?php echo $foo ?>', 'php');
  21. $this->assertEquals('bar', $renderer->evaluate($template, array('foo' => 'bar')), '->evaluate() renders templates that are instances of StringStorage');
  22. $template = new FileStorage(__DIR__.'/../Fixtures/templates/foo.php', 'php');
  23. $this->assertEquals('bar', $renderer->evaluate($template, array('foo' => 'bar')), '->evaluate() renders templates that are instances of FileStorage');
  24. }
  25. }