Add docs.

Create compile dir for tests
This commit is contained in:
Ivan Shalganov
2013-02-07 20:04:00 +04:00
parent e969f1b4fc
commit 1ad3d6533d
6 changed files with 152 additions and 18 deletions

View File

@ -10,30 +10,13 @@ class TemplateTest extends \PHPUnit_Framework_TestCase {
*/
public static $aspect;
public function _testSandbox() {
//self::$aspect->storeTemplate(self::$aspect->compileCode("<b>Welcome, {block username}{/block} ({block name='email'}{/block})</b>", "parent.tpl"));
/*self::$aspect->storeTemplate(new Render("parent.tpl", function () {
echo "<b>Welcome, {block name='username'}{/block} ({block name='usermail'}{/block})</b>";
}));*/
try {
} catch(\Exception $e) {
echo $e->getTraceAsString();
drop($e->getMessage(), $e->getFile().":".$e->getLine());
}
}
public function setUp() {
exec("rm -f ".ASPECT_RESOURCES.'/compile/*');
mkdir(ASPECT_RESOURCES.'/compile', 0777, true);
self::$aspect = Aspect::factory(ASPECT_RESOURCES.'/template', ASPECT_RESOURCES.'/compile');
self::$aspect->addTemplate(new Render("welcome.tpl", function ($tpl) {
echo "<b>Welcome, ".$tpl["username"]." (".$tpl["email"].")</b>";
}, array()));
/*$parent = self::$aspect->compileCode('Parent template block1: {block name="bk1"}{/block}
block2: {block "bk2"} default block 2{/block}
{var $bk="bk3"}
block3: {block "$bk"} default block 3{/block} ', "parent.tpl");
self::$aspect->addTemplate($parent);*/
}

View File

@ -15,6 +15,7 @@ class AspectTest extends \PHPUnit_Framework_TestCase {
}
public function setUp() {
mkdir(ASPECT_RESOURCES.'/compile', 0777, true);
self::tearDownAfterClass();
$this->aspect = $aspect = Aspect::factory(ASPECT_RESOURCES.'/template', ASPECT_RESOURCES.'/compile');
$aspect->setCompileDir(ASPECT_RESOURCES.'/compile');