[FrameworkBundle] Add path verification to the template parsing test cases
This commit is contained in:
parent
9962f36f97
commit
cd42e2de93
@ -43,30 +43,31 @@ class TemplateNameParserTest extends TestCase
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @dataProvider getLogicalNameToTemplateProvider
|
* @dataProvider parseProvider
|
||||||
*/
|
*/
|
||||||
public function testParse($name, $ref)
|
public function testParse($name, $logicalName, $path, $ref)
|
||||||
{
|
{
|
||||||
$template = $this->parser->parse($name);
|
$template = $this->parser->parse($name);
|
||||||
|
|
||||||
$this->assertEquals($template->getLogicalName(), $ref->getLogicalName());
|
$this->assertSame($ref->getLogicalName(), $template->getLogicalName());
|
||||||
$this->assertEquals($template->getLogicalName(), $name);
|
$this->assertSame($logicalName, $template->getLogicalName());
|
||||||
|
$this->assertSame($path, $template->getPath());
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getLogicalNameToTemplateProvider()
|
public function parseProvider()
|
||||||
{
|
{
|
||||||
return array(
|
return array(
|
||||||
array('FooBundle:Post:index.html.php', new TemplateReference('FooBundle', 'Post', 'index', 'html', 'php')),
|
array('FooBundle:Post:index.html.php', 'FooBundle:Post:index.html.php', '@FooBundle/Resources/views/Post/index.html.php', new TemplateReference('FooBundle', 'Post', 'index', 'html', 'php')),
|
||||||
array('FooBundle:Post:index.html.twig', new TemplateReference('FooBundle', 'Post', 'index', 'html', 'twig')),
|
array('FooBundle:Post:index.html.twig', 'FooBundle:Post:index.html.twig', '@FooBundle/Resources/views/Post/index.html.twig', new TemplateReference('FooBundle', 'Post', 'index', 'html', 'twig')),
|
||||||
array('FooBundle:Post:index.xml.php', new TemplateReference('FooBundle', 'Post', 'index', 'xml', 'php')),
|
array('FooBundle:Post:index.xml.php', 'FooBundle:Post:index.xml.php', '@FooBundle/Resources/views/Post/index.xml.php', new TemplateReference('FooBundle', 'Post', 'index', 'xml', 'php')),
|
||||||
array('SensioFooBundle:Post:index.html.php', new TemplateReference('SensioFooBundle', 'Post', 'index', 'html', 'php')),
|
array('SensioFooBundle:Post:index.html.php', 'SensioFooBundle:Post:index.html.php', '@SensioFooBundle/Resources/views/Post/index.html.php', new TemplateReference('SensioFooBundle', 'Post', 'index', 'html', 'php')),
|
||||||
array('SensioCmsFooBundle:Post:index.html.php', new TemplateReference('SensioCmsFooBundle', 'Post', 'index', 'html', 'php')),
|
array('SensioCmsFooBundle:Post:index.html.php', 'SensioCmsFooBundle:Post:index.html.php', '@SensioCmsFooBundle/Resources/views/Post/index.html.php', new TemplateReference('SensioCmsFooBundle', 'Post', 'index', 'html', 'php')),
|
||||||
array(':Post:index.html.php', new TemplateReference('', 'Post', 'index', 'html', 'php')),
|
array(':Post:index.html.php', ':Post:index.html.php', 'views/Post/index.html.php', new TemplateReference('', 'Post', 'index', 'html', 'php')),
|
||||||
array('::index.html.php', new TemplateReference('', '', 'index', 'html', 'php')),
|
array('::index.html.php', '::index.html.php', 'views/index.html.php', new TemplateReference('', '', 'index', 'html', 'php')),
|
||||||
array('FooBundle:Post:foo.bar.index.html.php', new TemplateReference('FooBundle', 'Post', 'foo.bar.index', 'html', 'php')),
|
array('FooBundle:Post:foo.bar.index.html.php', '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')),
|
||||||
array('/path/to/section/name.php', new BaseTemplateReference('/path/to/section/name.php', 'php')),
|
array('/path/to/section/name.php', '/path/to/section/name.php', '/path/to/section/name.php', new BaseTemplateReference('/path/to/section/name.php', 'php')),
|
||||||
array('name.twig', new BaseTemplateReference('name.twig', 'twig')),
|
array('name.twig', 'name.twig', 'name.twig', new BaseTemplateReference('name.twig', 'twig')),
|
||||||
array('name', new BaseTemplateReference('name')),
|
array('name', 'name', 'name', new BaseTemplateReference('name')),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user