修复内置模版引擎无法自动获取静态缓存的问题

This commit is contained in:
tale
2016-03-17 23:29:54 +08:00
parent 14ee945b0c
commit 01a3c5aee5
2 changed files with 20 additions and 2 deletions

View File

@@ -319,8 +319,10 @@ EOF;
$template = new Template();
$template->assign('name', 'name');
$config = [
'strip_space' => true,
'view_path' => dirname(__FILE__) . '/',
'strip_space' => true,
'view_path' => dirname(__FILE__) . '/',
'cache_id' => '__CACHE_ID__',
'display_cache'=> true
];
$data = ['name' => 'value'];
$template->layout('layout')->display('display', $data, $config);
@@ -401,4 +403,12 @@ EOF;
$template->assign($data);
$this->assertEquals($data, $template->get());
}
public function testIsCache()
{
$template = new Template(['cache_id' => '__CACHE_ID__','display_cache' => true]);
$this->assertTrue(!$template->isCache('__CACHE_ID__'));
$template->display_cache = false;
$this->assertTrue(!$template->isCache('__CACHE_ID__'));
}
}