diff --git a/library/think/Build.php b/library/think/Build.php
index 86dd6887..5b7306cf 100644
--- a/library/think/Build.php
+++ b/library/think/Build.php
@@ -101,13 +101,13 @@ class Build
$namespace = APP_NAMESPACE . '\\' . ($module ? $module . '\\' : '') . $path;
$class = $val . (CLASS_APPEND_SUFFIX ? ucfirst($path) : '');
switch ($path) {
- case CONTROLLER_LAYER: // 控制器
+ case CONTROLLER_LAYER: // 控制器
$content = "config['view_suffix'];
+ return realpath($path) . DS . $template . $this->config['view_suffix'];
}
/**
diff --git a/tests/thinkphp/library/think/view/default/index/template.html b/tests/thinkphp/library/think/view/default/index/template.html
new file mode 100644
index 00000000..5f4548be
--- /dev/null
+++ b/tests/thinkphp/library/think/view/default/index/template.html
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+
+
+ Document
+
+
+
+
+
diff --git a/tests/thinkphp/library/think/viewTest.php b/tests/thinkphp/library/think/viewTest.php
index 590b258b..b4b41d59 100644
--- a/tests/thinkphp/library/think/viewTest.php
+++ b/tests/thinkphp/library/think/viewTest.php
@@ -121,12 +121,14 @@ class viewTest extends \PHPUnit_Framework_TestCase
public function testParseTemplate()
{
$view_instance = \think\View::instance();
- $method = new \ReflectionMethod('\think\View', 'ParseTemplate');
+ $view_instance->theme(true);
+ $view_instance->config(['view_path' => __DIR__ . DS]);
+ $method = new \ReflectionMethod('\think\View', 'ParseTemplate');
$method->setAccessible(true);
if (defined('CONTROLLER_NAME')) {
- $expect_data = 'view_path' . 'theme_name' . DS . CONTROLLER_NAME . DS . 'template_name.html';
+ $expect_data = __DIR__ . DS . 'default' . DS . CONTROLLER_NAME . DS . 'template.html';
} else {
- $expect_data = 'view_path' . 'theme_name' . DS . 'template_name.html';
+ $expect_data = __DIR__ . DS . 'default' . DS . 'template.html';
}
$this->assertEquals($expect_data, $method->invoke($view_instance, 'template_name'));
}