diff --git a/lib/DwooTransformer.php b/lib/DwooTransformer.php index 3ff584c..d41ffe5 100644 --- a/lib/DwooTransformer.php +++ b/lib/DwooTransformer.php @@ -56,7 +56,8 @@ public function __construct(array $options = array()) $this->dwoo->setCompileDir($options['compile-dir']); } - $this->dwoo->setTemplateDir(null); + $this->dwoo->setTemplateDir(getcwd());// Current working directory + $this->dwoo->setTemplateDir(null);// File System root if (array_key_exists('template-dir', $options)) { $this->dwoo->setTemplateDir($options['template-dir']); } diff --git a/tests/DwooTransformerTest.php b/tests/DwooTransformerTest.php index 5d117cc..e17d0ed 100644 --- a/tests/DwooTransformerTest.php +++ b/tests/DwooTransformerTest.php @@ -54,4 +54,25 @@ public function testConstructor() self::assertEquals('Hello, Linus!', $actual); } + + /** + * @dataProvider dataProvider + * @param string $path + */ + public function testTemplatePaths($path) + { + $engine = new DwooTransformer(); + + $actual = $engine->renderFile($path, array('name' => 'Linus')); + + self::assertEquals('Hello, Linus!', $actual); + } + + public function dataProvider() + { + return array( + array('tests/Fixtures/template.tpl'), + array(__DIR__.'/Fixtures/template.tpl'), + ); + } }