TemplateTest.php 1.2 KB

123456789101112131415161718192021222324252627282930313233343536
  1. <?php
  2. /*
  3. * This file is part of the Symfony package.
  4. *
  5. * (c) Fabien Potencier <fabien@symfony.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\Bundle\FrameworkBundle\Tests\Templating;
  11. use Symfony\Bundle\FrameworkBundle\Templating\TemplateReference;
  12. use Symfony\Bundle\FrameworkBundle\Tests\TestCase;
  13. class TemplateTest extends TestCase
  14. {
  15. /**
  16. * @dataProvider getTemplateToPathProvider
  17. */
  18. public function testGetPathForTemplate($template, $path)
  19. {
  20. $this->assertSame($template->getPath(), $path);
  21. }
  22. public function getTemplateToPathProvider()
  23. {
  24. return array(
  25. array(new TemplateReference('FooBundle', 'Post', 'index', 'html', 'php'), '@FooBundle/Resources/views/Post/index.html.php'),
  26. array(new TemplateReference('FooBundle', '', 'index', 'html', 'twig'), '@FooBundle/Resources/views/index.html.twig'),
  27. array(new TemplateReference('', 'Post', 'index', 'html', 'php'), 'views/Post/index.html.php'),
  28. array(new TemplateReference('', '', 'index', 'html', 'php'), 'views/index.html.php'),
  29. );
  30. }
  31. }