From: Fabien Potencier Date: Mon, 27 May 2013 06:08:37 +0000 (+0200) Subject: added the possibility to ignore the filesystem constructor argument (closes #1104) X-Git-Url: http://git.silmor.de/gitweb/?a=commitdiff_plain;h=f6c00587f8b2d6e680d09fd6015fa521f9c72327;p=web%2Fkonrad%2Ftwig.git added the possibility to ignore the filesystem constructor argument (closes #1104) --- diff --git a/lib/Twig/Loader/Filesystem.php b/lib/Twig/Loader/Filesystem.php index 84a5e03..f9211cb 100644 --- a/lib/Twig/Loader/Filesystem.php +++ b/lib/Twig/Loader/Filesystem.php @@ -24,9 +24,11 @@ class Twig_Loader_Filesystem implements Twig_LoaderInterface, Twig_ExistsLoaderI * * @param string|array $paths A path or an array of paths where to look for templates */ - public function __construct($paths) + public function __construct($paths = array()) { - $this->setPaths($paths); + if ($paths) { + $this->setPaths($paths); + } } /** diff --git a/test/Twig/Tests/Loader/FilesystemTest.php b/test/Twig/Tests/Loader/FilesystemTest.php index 798e994..c3f6ece 100644 --- a/test/Twig/Tests/Loader/FilesystemTest.php +++ b/test/Twig/Tests/Loader/FilesystemTest.php @@ -80,6 +80,12 @@ class Twig_Tests_Loader_FilesystemTest extends PHPUnit_Framework_TestCase $this->assertEquals("named path (final)\n", $loader->getSource('@named/index.html')); } + public function testEmptyConstructor() + { + $loader = new Twig_Loader_Filesystem(); + $this->assertEquals(array(), $loader->getPaths()); + } + public function testGetNamespaces() { $loader = new Twig_Loader_Filesystem(sys_get_temp_dir());