From 97d156ce24aba1443f83d1f964320578f0928928 Mon Sep 17 00:00:00 2001 From: Matt Hackmann Date: Tue, 27 Oct 2015 20:17:33 -0700 Subject: [PATCH] updated tests for custom extension --- tests/Dust/FilesystemTest.php | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) mode change 100644 => 100755 tests/Dust/FilesystemTest.php diff --git a/tests/Dust/FilesystemTest.php b/tests/Dust/FilesystemTest.php old mode 100644 new mode 100755 index b828c31..4ceba12 --- a/tests/Dust/FilesystemTest.php +++ b/tests/Dust/FilesystemTest.php @@ -3,7 +3,7 @@ class FilesystemTest extends DustTestBase { public static $dir; - + public static function setUpBeforeClass() { FilesystemTest::$dir = sys_get_temp_dir(); if (FilesystemTest::$dir[strlen(FilesystemTest::$dir) - 1] != '/') FilesystemTest::$dir .= '/'; @@ -18,8 +18,14 @@ public static function setUpBeforeClass() { //add child template $fileRes = file_put_contents(FilesystemTest::$dir . '/childTemplate.dust', '{>baseTemplate/}{dust->compileFile(FilesystemTest::$dir . '/childTemplate'); $expected = "before\noneDefault...newTwo...newThree\nafter"; $this->assertEquals($expected, $this->dust->renderTemplate($compiled, (object)[])); } - + public function testIncludedDirectories() { //add the dir $this->dust->includedDirectories[] = FilesystemTest::$dir; //now have something call the child $this->assertTemplate("Begin - before\noneDefault...newTwo...newThree\nafter - End", 'Begin - {>childTemplate/} - End', (object)[]); } - + + public function testCustomFileExtension() { + $dust = new Dust(null, null, [ 'extension' => 'tl' ]); + $dust->includedDirectories[] = FilesystemTest::$dir; + $template = $dust->compile('{>simpleTemplate/}'); + $render = $dust->renderTemplate($template, (object)[]); + $this->assertEquals($render, "line1\nline2"); + } + } \ No newline at end of file