From c503287744f77a3eb84f04bc49b1e93b24b46bd4 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Martin=20Haso=C5=88?= Date: Mon, 17 Sep 2012 14:11:40 +0200 Subject: [PATCH] Fixed typo in Filesystem loader --- lib/Twig/Loader/Filesystem.php | 2 +- test/Twig/Tests/Loader/FilesystemTest.php | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletions(-) 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()); + } } -- 1.7.2.5