public function Twig_Tests_Loader_FilesystemTest::testPaths in Zircon Profile 8
Same name and namespace in other branches
- 8.0 vendor/twig/twig/test/Twig/Tests/Loader/FilesystemTest.php \Twig_Tests_Loader_FilesystemTest::testPaths()
File
- vendor/
twig/ twig/ test/ Twig/ Tests/ Loader/ FilesystemTest.php, line 54
Class
Code
public function testPaths() {
$basePath = dirname(__FILE__) . '/Fixtures';
$loader = new Twig_Loader_Filesystem(array(
$basePath . '/normal',
$basePath . '/normal_bis',
));
$loader
->setPaths(array(
$basePath . '/named',
$basePath . '/named_bis',
), 'named');
$loader
->addPath($basePath . '/named_ter', 'named');
$loader
->addPath($basePath . '/normal_ter');
$loader
->prependPath($basePath . '/normal_final');
$loader
->prependPath($basePath . '/named/../named_quater', 'named');
$loader
->prependPath($basePath . '/named_final', 'named');
$this
->assertEquals(array(
$basePath . '/normal_final',
$basePath . '/normal',
$basePath . '/normal_bis',
$basePath . '/normal_ter',
), $loader
->getPaths());
$this
->assertEquals(array(
$basePath . '/named_final',
$basePath . '/named/../named_quater',
$basePath . '/named',
$basePath . '/named_bis',
$basePath . '/named_ter',
), $loader
->getPaths('named'));
$this
->assertEquals(realpath($basePath . '/named_quater/named_absolute.html'), realpath($loader
->getCacheKey('@named/named_absolute.html')));
$this
->assertEquals("path (final)\n", $loader
->getSource('index.html'));
$this
->assertEquals("path (final)\n", $loader
->getSource('@__main__/index.html'));
$this
->assertEquals("named path (final)\n", $loader
->getSource('@named/index.html'));
}