Skip to content

Commit

Permalink
Fix issue with relative path
Browse files Browse the repository at this point in the history
  • Loading branch information
MacFJA committed Mar 2, 2016
1 parent 259821e commit 90fed39
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/DwooTransformer.php
Original file line number Diff line number Diff line change
Expand Up @@ -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']);
}
Expand Down
21 changes: 21 additions & 0 deletions tests/DwooTransformerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'),
);
}
}

0 comments on commit 90fed39

Please sign in to comment.