From 1db6c886a09d27fb714fe26a40c46bf13c918626 Mon Sep 17 00:00:00 2001 From: Haotong Lin Date: Thu, 3 Mar 2016 11:13:59 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E5=96=84=E5=8D=95=E5=85=83=E6=B5=8B?= =?UTF-8?q?=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tests/thinkphp/library/think/controllerTest.php | 17 ++++++++++------- tests/thinkphp/library/think/cookieTest.php | 2 +- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/tests/thinkphp/library/think/controllerTest.php b/tests/thinkphp/library/think/controllerTest.php index 91be8389..e9a8175c 100644 --- a/tests/thinkphp/library/think/controllerTest.php +++ b/tests/thinkphp/library/think/controllerTest.php @@ -18,6 +18,7 @@ namespace tests\thinkphp\library\think; use ReflectionClass; use think\Controller; +use think\View; require_once CORE_PATH . '../../helper.php'; @@ -107,17 +108,19 @@ class controllerTest extends \PHPUnit_Framework_TestCase private function getView($controller) { + $view = new View(); $rc = new ReflectionClass(get_class($controller)); $property = $rc->getProperty('view'); $property->setAccessible(true); - return $property->getValue($controller); + $property->setValue($controller, $view); + return $view; } public function testFetch() { - $controller = new Foo; - $view = $this->getView($controller); - $template = __DIR__ . '/display'; + $controller = new Foo; + $view = $this->getView($controller); + $template = dirname(__FILE__) . '/display.html'; $viewFetch = $view->fetch($template, ['name' => 'ThinkPHP']); $controllerFetch = $controller->fetch($template, ['name' => 'ThinkPHP']); $this->assertEquals($controllerFetch, $viewFetch); @@ -125,9 +128,9 @@ class controllerTest extends \PHPUnit_Framework_TestCase public function testShow() { - $controller = new Foo; - $view = $this->getView($controller); - $template = __DIR__ . '/display'; + $controller = new Foo; + $view = $this->getView($controller); + $template = dirname(__FILE__) . '/display.html'; $viewFetch = $view->show($template, ['name' => 'ThinkPHP']); $controllerFetch = $controller->show($template, ['name' => 'ThinkPHP']); $this->assertEquals($controllerFetch, $viewFetch); diff --git a/tests/thinkphp/library/think/cookieTest.php b/tests/thinkphp/library/think/cookieTest.php index 885fec7f..24cb153e 100644 --- a/tests/thinkphp/library/think/cookieTest.php +++ b/tests/thinkphp/library/think/cookieTest.php @@ -37,7 +37,7 @@ class cookieTest extends \PHPUnit_Framework_TestCase // httponly设置 'httponly' => '', // 是否使用 setcookie - 'setcookie' => true, + 'setcookie' => false, ]; protected function setUp()