Fix tests

Add docs
This commit is contained in:
Ivan Shalganov
2013-02-08 14:23:10 +04:00
parent a27f604eb5
commit 0659d27878
7 changed files with 71 additions and 116 deletions

View File

@@ -11,8 +11,11 @@ class TemplateTest extends \PHPUnit_Framework_TestCase {
public static $aspect;
public function setUp() {
exec("rm -f ".ASPECT_RESOURCES.'/compile/*');
mkdir(ASPECT_RESOURCES.'/compile', 0777, true);
if(!file_exists(ASPECT_RESOURCES.'/compile')) {
mkdir(ASPECT_RESOURCES.'/compile', 0777, true);
} else {
exec("rm -f ".ASPECT_RESOURCES.'/compile/*');
}
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>";

View File

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