Fixed typo in Filesystem loader

This commit is contained in:
Martin Hasoň
2012-09-17 14:11:40 +02:00
parent c38e06ff41
commit c503287744
2 changed files with 10 additions and 1 deletions
+1 -1
View File
@@ -51,7 +51,7 @@ class Twig_Loader_Filesystem implements Twig_LoaderInterface
*/
public function getNamespaces()
{
return array_keys($this->paths[$namespace]);
return array_keys($this->paths);
}
/**
@@ -78,4 +78,13 @@ class Twig_Tests_Loader_FilesystemTest extends PHPUnit_Framework_TestCase
$this->assertEquals("path (final)\n", $loader->getSource('@__main__/index.html'));
$this->assertEquals("named path (final)\n", $loader->getSource('@named/index.html'));
}
public function testGetNamespaces()
{
$loader = new Twig_Loader_Filesystem(sys_get_temp_dir());
$this->assertEquals(array('__main__'), $loader->getNamespaces());
$loader->addPath(sys_get_temp_dir(), 'named');
$this->assertEquals(array('__main__', 'named'), $loader->getNamespaces());
}
}