Skip to content

Commit d024fde

Browse files
committed
[FrameworkBundle] Add path verification to the template parsing test cases
1 parent 9962f36 commit d024fde

File tree

1 file changed

+15
-14
lines changed

1 file changed

+15
-14
lines changed

src/Symfony/Bundle/FrameworkBundle/Tests/Templating/TemplateNameParserTest.php

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -45,28 +45,29 @@ protected function tearDown()
4545
/**
4646
* @dataProvider getLogicalNameToTemplateProvider
4747
*/
48-
public function testParse($name, $ref)
48+
public function testParse($name, $path, $ref)
4949
{
5050
$template = $this->parser->parse($name);
5151

52-
$this->assertEquals($template->getLogicalName(), $ref->getLogicalName());
53-
$this->assertEquals($template->getLogicalName(), $name);
52+
$this->assertSame($ref->getLogicalName(), $template->getLogicalName());
53+
$this->assertSame($name, $template->getLogicalName());
54+
$this->assertSame($path, $template->getPath());
5455
}
5556

5657
public function getLogicalNameToTemplateProvider()
5758
{
5859
return array(
59-
array('FooBundle:Post:index.html.php', new TemplateReference('FooBundle', 'Post', 'index', 'html', 'php')),
60-
array('FooBundle:Post:index.html.twig', new TemplateReference('FooBundle', 'Post', 'index', 'html', 'twig')),
61-
array('FooBundle:Post:index.xml.php', new TemplateReference('FooBundle', 'Post', 'index', 'xml', 'php')),
62-
array('SensioFooBundle:Post:index.html.php', new TemplateReference('SensioFooBundle', 'Post', 'index', 'html', 'php')),
63-
array('SensioCmsFooBundle:Post:index.html.php', new TemplateReference('SensioCmsFooBundle', 'Post', 'index', 'html', 'php')),
64-
array(':Post:index.html.php', new TemplateReference('', 'Post', 'index', 'html', 'php')),
65-
array('::index.html.php', new TemplateReference('', '', 'index', 'html', 'php')),
66-
array('FooBundle:Post:foo.bar.index.html.php', new TemplateReference('FooBundle', 'Post', 'foo.bar.index', 'html', 'php')),
67-
array('/path/to/section/name.php', new BaseTemplateReference('/path/to/section/name.php', 'php')),
68-
array('name.twig', new BaseTemplateReference('name.twig', 'twig')),
69-
array('name', new BaseTemplateReference('name')),
60+
array('FooBundle:Post:index.html.php', '@FooBundle/Resources/views/Post/index.html.php', new TemplateReference('FooBundle', 'Post', 'index', 'html', 'php')),
61+
array('FooBundle:Post:index.html.twig', '@FooBundle/Resources/views/Post/index.html.twig', new TemplateReference('FooBundle', 'Post', 'index', 'html', 'twig')),
62+
array('FooBundle:Post:index.xml.php', '@FooBundle/Resources/views/Post/index.xml.php', new TemplateReference('FooBundle', 'Post', 'index', 'xml', 'php')),
63+
array('SensioFooBundle:Post:index.html.php', '@SensioFooBundle/Resources/views/Post/index.html.php', new TemplateReference('SensioFooBundle', 'Post', 'index', 'html', 'php')),
64+
array('SensioCmsFooBundle:Post:index.html.php', '@SensioCmsFooBundle/Resources/views/Post/index.html.php', new TemplateReference('SensioCmsFooBundle', 'Post', 'index', 'html', 'php')),
65+
array(':Post:index.html.php', 'views/Post/index.html.php', new TemplateReference('', 'Post', 'index', 'html', 'php')),
66+
array('::index.html.php', 'views/index.html.php', new TemplateReference('', '', 'index', 'html', 'php')),
67+
array('FooBundle:Post:foo.bar.index.html.php', '@FooBundle/Resources/views/Post/foo.bar.index.html.php', new TemplateReference('FooBundle', 'Post', 'foo.bar.index', 'html', 'php')),
68+
array('/path/to/section/name.php', '/path/to/section/name.php', new BaseTemplateReference('/path/to/section/name.php', 'php')),
69+
array('name.twig', 'name.twig', new BaseTemplateReference('name.twig', 'twig')),
70+
array('name', 'name', new BaseTemplateReference('name')),
7071
);
7172
}
7273

0 commit comments

Comments
 (0)