mirror of
https://github.com/fenom-template/fenom.git
synced 2023-08-10 21:13:07 +03:00
Fix tests
This commit is contained in:
parent
2fc84c226e
commit
7c038e0ba9
@ -69,7 +69,7 @@ class Compiler
|
|||||||
}
|
}
|
||||||
$inc = $tpl->getStorage()->compile($name, false);
|
$inc = $tpl->getStorage()->compile($name, false);
|
||||||
$tpl->addDepend($inc);
|
$tpl->addDepend($inc);
|
||||||
return '?>' . $tpl->getBody() . '<?php';
|
return '?>' . $inc->getBody() . '<?php';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -103,6 +103,7 @@ class TestCase extends \PHPUnit_Framework_TestCase
|
|||||||
mkdir(FENOM_RESOURCES . '/template/' . $dir, 0777, true);
|
mkdir(FENOM_RESOURCES . '/template/' . $dir, 0777, true);
|
||||||
}
|
}
|
||||||
file_put_contents(FENOM_RESOURCES . '/template/' . $name, $code);
|
file_put_contents(FENOM_RESOURCES . '/template/' . $name, $code);
|
||||||
|
return filemtime(FENOM_RESOURCES . '/template/' . $name);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -163,9 +164,10 @@ class TestCase extends \PHPUnit_Framework_TestCase
|
|||||||
{
|
{
|
||||||
$template = $this->fenom->compileCode($tpl);
|
$template = $this->fenom->compileCode($tpl);
|
||||||
if ($debug) {
|
if ($debug) {
|
||||||
print_r("$tpl:\n" . $template->getBody());
|
print_r("\nDEBUG $tpl:\n" . $template->getBody());
|
||||||
}
|
}
|
||||||
$this->assertSame($result, $template->fetch($this->values));
|
$this->assertSame($result, $template->fetch($this->values));
|
||||||
|
return $template;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -266,7 +266,7 @@ class TemplateTest extends TestCase
|
|||||||
"username" => "Master",
|
"username" => "Master",
|
||||||
"email" => "dev@null.net"
|
"email" => "dev@null.net"
|
||||||
);
|
);
|
||||||
$result = 'Include <b>Welcome, Master (dev@null.net)</b> template';
|
$result = 'Include <b>Welcome, Master (dev@null.net)</b> template';
|
||||||
return array(
|
return array(
|
||||||
array('Include {insert "welcome.tpl"} template', $a, $result),
|
array('Include {insert "welcome.tpl"} template', $a, $result),
|
||||||
array("Include {insert 'welcome.tpl'} template", $a, $result),
|
array("Include {insert 'welcome.tpl'} template", $a, $result),
|
||||||
@ -839,10 +839,8 @@ class TemplateTest extends TestCase
|
|||||||
*/
|
*/
|
||||||
public function testInsert($code, $vars, $result)
|
public function testInsert($code, $vars, $result)
|
||||||
{
|
{
|
||||||
$this->tpl('insert.tpl', $code);
|
$this->values = $vars;
|
||||||
$this->assertRender('insert.tpl', $result, $vars);
|
$tpl = $this->assertRender($code, $result);
|
||||||
$tpl = $this->exec($code, $vars, $result);
|
|
||||||
$this->assertTrue($tpl->isValid());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user