Fixed typo in Filesystem loader
authorMartin Hasoň <martin.hason@gmail.com>
Mon, 17 Sep 2012 12:11:40 +0000 (14:11 +0200)
committerMartin Hasoň <martin.hason@gmail.com>
Mon, 17 Sep 2012 12:11:40 +0000 (14:11 +0200)
lib/Twig/Loader/Filesystem.php
test/Twig/Tests/Loader/FilesystemTest.php

index ab0dde2..4371c17 100644 (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);
     }
 
     /**
index 85bb6e5..9ea2d0e 100644 (file)
@@ -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());
+    }
 }