mirror of
https://github.com/fenom-template/fenom.git
synced 2023-08-10 21:13:07 +03:00
Tests++
This commit is contained in:
parent
a910b71a81
commit
1e724e4c70
@ -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);
|
||||
}
|
||||
} else {
|
||||
$key = $options . "@" . $template;
|
||||
}
|
||||
|
@ -48,15 +48,20 @@ class TestCase extends \PHPUnit_Framework_TestCase
|
||||
);
|
||||
}
|
||||
|
||||
public function setUp()
|
||||
public function getCompilePath()
|
||||
{
|
||||
if (!file_exists(FENOM_RESOURCES . '/compile')) {
|
||||
mkdir(FENOM_RESOURCES . '/compile', 0777, true);
|
||||
} else {
|
||||
FS::clean(FENOM_RESOURCES . '/compile/');
|
||||
return FENOM_RESOURCES . '/compile';
|
||||
}
|
||||
|
||||
$this->fenom = Fenom::factory(FENOM_RESOURCES . '/' . $this->template_path, FENOM_RESOURCES . '/compile');
|
||||
public function setUp()
|
||||
{
|
||||
if (!file_exists($this->getCompilePath())) {
|
||||
mkdir($this->getCompilePath(), 0777, true);
|
||||
} else {
|
||||
FS::clean($this->getCompilePath());
|
||||
}
|
||||
|
||||
$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');
|
||||
|
@ -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");
|
||||
|
Loading…
Reference in New Issue
Block a user