PhpRendererTest.php 1.0 KB

123456789101112131415161718192021222324252627282930
  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. require_once __DIR__.'/../../../../bootstrap.php';
  11. use Symfony\Components\Templating\Renderer\PhpRenderer;
  12. use Symfony\Components\Templating\Storage\Storage;
  13. use Symfony\Components\Templating\Storage\StringStorage;
  14. use Symfony\Components\Templating\Storage\FileStorage;
  15. $t = new LimeTest(2);
  16. $renderer = new PhpRenderer();
  17. // ->evaluate()
  18. $t->diag('->evaluate()');
  19. $template = new StringStorage('<?php echo $foo ?>');
  20. $t->is($renderer->evaluate($template, array('foo' => 'bar')), 'bar', '->evaluate() renders templates that are instances of StringStorage');
  21. $template = new FileStorage(__DIR__.'/../../../../../fixtures/Symfony/Components/Templating/templates/foo.php');
  22. $t->is($renderer->evaluate($template, array('foo' => 'bar')), 'bar', '->evaluate() renders templates that are instances of FileStorage');