diff --git a/tests/classes/template/TemplateHandlerTest.class.php b/tests/classes/template/TemplateHandlerTest.class.php
index 42759109c..a50331085 100644
--- a/tests/classes/template/TemplateHandlerTest.class.php
+++ b/tests/classes/template/TemplateHandlerTest.class.php
@@ -2,6 +2,7 @@
define('__DEBUG__', 1);
define('_XE_PATH_', realpath(dirname(__FILE__).'/../../../'));
+require _XE_PATH_.'/classes/file/FileHandler.class.php';
require _XE_PATH_.'/classes/template/TemplateHandler.class.php';
$_SERVER['SCRIPT_NAME'] = '/xe/index.php';
@@ -25,8 +26,8 @@ class TemplateHandlerTest extends PHPUnit_Framework_TestCase
),
// cond
array(
- 'Link1Link2',
- 'Link1var==$__Context->key){ ?>Link2'
+ 'Link1Link2',
+ 'Link1v==$__Context->k){ ?>Link2'
),
// for loop
array(
@@ -83,6 +84,11 @@ class TemplateHandlerTest extends PHPUnit_Framework_TestCase
'ABC',
'var){ ?>ABC'
),
+ // invalid block statement
+ array(
+ '',
+ ''
+ ),
// {@ ...PHP_CODE...}
array(
'{@$list_page = $page_no}',
@@ -118,6 +124,11 @@ class TemplateHandlerTest extends PHPUnit_Framework_TestCase
'',
''
),
+ //
+ array(
+ '',
+ 'compile(); ?>'
+ ),
//
array(
'',
@@ -178,8 +189,26 @@ class TemplateHandlerTest extends PHPUnit_Framework_TestCase
{
$tmpl = TemplateHandler::getInstance();
$tmpl->init(dirname(__FILE__), 'sample.html');
- $result = $tmpl->parse($tpl, $expected);
+ $result = $tmpl->parse($tpl);
$this->assertEquals($result, $this->prefix.$expected);
}
+
+ public function testParse2()
+ {
+ $tmpl = TemplateHandler::getInstance();
+ $tmpl->init(dirname(__FILE__), 'no_file.html');
+
+ $result = $tmpl->parse();
+ $this->assertEquals($result, '');
+ }
+
+ public function testCompileDirect()
+ {
+ $tmpl = TemplateHandler::getInstance();
+ $result = $tmpl->compileDirect(dirname(__FILE__), 'sample.html');
+ $result = trim($result);
+
+ $this->assertEquals($result, $this->prefix.'has_blog){ ?>Taggon\'s blog');
+ }
}
diff --git a/tests/classes/template/sample.html b/tests/classes/template/sample.html
index 3ce557d85..949b441ba 100644
--- a/tests/classes/template/sample.html
+++ b/tests/classes/template/sample.html
@@ -1 +1 @@
-
+Taggon's blog