diff --git a/tests/thinkphp/library/think/templateTest.php b/tests/thinkphp/library/think/templateTest.php index e4ebd77d..aa14b94f 100644 --- a/tests/thinkphp/library/think/templateTest.php +++ b/tests/thinkphp/library/think/templateTest.php @@ -169,7 +169,7 @@ EOF; $content = << EOF; @@ -179,7 +179,7 @@ EOF; $content = << EOF; @@ -190,7 +190,7 @@ EOF; {\$name} {\$name|trim|substr=0,3} EOF; - $data = << EOF; @@ -209,7 +209,7 @@ EOF; $content = << EOF; - $data = <<a) ? (is_array(\$info)?\$info['a']:\$info->a) : 'test'; ?> EOF; @@ -219,7 +219,7 @@ EOF; $content = << EOF; - $data = <<a)==(is_array(\$info)?\$info['b']:\$info->b)) echo 'test'; ?> EOF; @@ -229,15 +229,15 @@ EOF; $content = << EOF; - $data = <<a) !== ''?(is_array(\$info)?\$info['a']:\$info->a):'test')?'yes':'no'; ?> EOF; $template->parse($content); $this->assertEquals($data, $content); - $template2 = new Template(); + $template2 = new Template(); $template2->tpl_var_identify = 'obj'; - $content = << 'extend', 'include' => 'include']; + $config['view_path'] = dirname(__FILE__) . '/'; + $config['view_suffix'] = '.html'; + $template = new Template($config); + $files = ['extend' => 'extend', 'include' => 'include']; $template->assign('files', $files); $content = << 'name']); define('SITE_NAME', 'site_name'); @@ -351,7 +351,7 @@ EOF; $template->assign('name', 'name'); $config = [ 'strip_space' => true, - 'tpl_path' => dirname(__FILE__) . '/', + 'view_path' => dirname(__FILE__) . '/', ]; $data = ['name' => 'value']; $template->display('display', $data, $config); @@ -360,10 +360,10 @@ EOF; public function testFetch() { - $template = new Template(); - $template->tpl_path = dirname(__FILE__) . '/'; - $data = ['name' => 'value']; - $content = <<view_path = dirname(__FILE__) . '/'; + $data = ['name' => 'value']; + $content = << 'a', 'b' => 'b']; + $data = ['a' => 'a', 'b' => 'b']; $template->assign($data); $this->assertEquals($data, $template->get()); }