From: Martin HasoĊˆ Date: Mon, 17 Sep 2012 12:11:40 +0000 (+0200) Subject: Fixed typo in Filesystem loader X-Git-Url: http://git.silmor.de/gitweb/?a=commitdiff_plain;h=c503287744f77a3eb84f04bc49b1e93b24b46bd4;p=konrad%2Ftwig.git Fixed typo in Filesystem loader --- diff --git a/lib/Twig/Loader/Filesystem.php b/lib/Twig/Loader/Filesystem.php index ab0dde2..4371c17 100644 --- a/lib/Twig/Loader/Filesystem.php +++ b/lib/Twig/Loader/Filesystem.php @@ -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); } /** diff --git a/test/Twig/Tests/Loader/FilesystemTest.php b/test/Twig/Tests/Loader/FilesystemTest.php index 85bb6e5..9ea2d0e 100644 --- a/test/Twig/Tests/Loader/FilesystemTest.php +++ b/test/Twig/Tests/Loader/FilesystemTest.php @@ -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()); + } }