diff --git a/src/Fenom.php b/src/Fenom.php index 7cb26ec..6e15d1d 100644 --- a/src/Fenom.php +++ b/src/Fenom.php @@ -998,12 +998,7 @@ class Fenom { $options |= $this->_options; if (is_array($template)) { - if(count($template) === 1) { - $template = current($template); - $key = $options . "@" . $template; - } else { - $key = $options . "@" . implode(",", $template); - } + $key = $options . "@" . implode(",", $template); } else { $key = $options . "@" . $template; } diff --git a/tests/TestCase.php b/tests/TestCase.php index 9f97fdb..c919bda 100644 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -48,15 +48,20 @@ class TestCase extends \PHPUnit_Framework_TestCase ); } + public function getCompilePath() + { + return FENOM_RESOURCES . '/compile'; + } + public function setUp() { - if (!file_exists(FENOM_RESOURCES . '/compile')) { - mkdir(FENOM_RESOURCES . '/compile', 0777, true); + if (!file_exists($this->getCompilePath())) { + mkdir($this->getCompilePath(), 0777, true); } else { - FS::clean(FENOM_RESOURCES . '/compile/'); + FS::clean($this->getCompilePath()); } - $this->fenom = Fenom::factory(FENOM_RESOURCES . '/' . $this->template_path, FENOM_RESOURCES . '/compile'); + $this->fenom = Fenom::factory(FENOM_RESOURCES . '/' . $this->template_path, $this->getCompilePath()); $this->fenom->addProvider('persist', new Provider(FENOM_RESOURCES . '/provider')); $this->fenom->addModifier('dots', __CLASS__ . '::dots'); $this->fenom->addModifier('concat', __CLASS__ . '::concat'); diff --git a/tests/cases/FenomTest.php b/tests/cases/FenomTest.php index d6f1f6b..737d34c 100644 --- a/tests/cases/FenomTest.php +++ b/tests/cases/FenomTest.php @@ -116,6 +116,19 @@ class FenomTest extends \Fenom\TestCase $this->assertSame("Custom template (new)", $this->fenom->fetch('custom.tpl', array())); } + /** + * @group dev + */ + public function testCompileIdAndName() + { + $this->fenom->setCompileId("iddqd."); + $this->tpl('custom.tpl', 'Custom template'); + $this->assertSame("Custom template", $this->fenom->fetch('custom.tpl', array())); + $compile_name = $this->fenom->getCompileName('custom.tpl'); + $this->assertFileExists($this->getCompilePath().'/'.$compile_name); + $this->assertStringStartsWith('iddqd.', $compile_name); + } + public function testSetModifier() { $this->fenom->addModifier("mymod", "myMod");