From 0acf217660f99d84ac222743f095ce01d674a5a5 Mon Sep 17 00:00:00 2001 From: thinkphp Date: Tue, 17 May 2016 14:13:05 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=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/responseTest.php | 42 +++---------------- 1 file changed, 5 insertions(+), 37 deletions(-) diff --git a/tests/thinkphp/library/think/responseTest.php b/tests/thinkphp/library/think/responseTest.php index 3154ea61..07545696 100644 --- a/tests/thinkphp/library/think/responseTest.php +++ b/tests/thinkphp/library/think/responseTest.php @@ -78,16 +78,15 @@ class responseTest extends \PHPUnit_Framework_TestCase */ public function testSend() { - $dataArr = array(); + $dataArr = []; $dataArr["key"] = "value"; - //$dataArr->key = "val"; - $response = new \think\response\Json(); - $result = $response->send($dataArr); + $response = Response::create($dataArr, 'json'); + $result = $response->send(); $this->assertEquals('{"key":"value"}', $result); $_GET['callback'] = 'callback'; - $response = new \think\response\Jsonp(); - $result = $response->options(['var_jsonp_handler' => 'callback'])->send($dataArr); + $response = Response::create($dataArr, 'jsonp'); + $result = $response->options(['var_jsonp_handler' => 'callback'])->send(); $this->assertEquals('callback({"key":"value"});', $result); $response = new Response(); @@ -100,35 +99,4 @@ class responseTest extends \PHPUnit_Framework_TestCase $_GET[Config::get('var_jsonp_handler')] = ""; } - /** - * @#runInSeparateProcess - * @covers think\Response::redirect - * @todo Implement testRedirect(). - */ - public function testRedirect() - { - // $url = "http://www.testredirect.com"; - // $params = array(); - // $params[] = 301; - - // // FIXME 静态方法mock Url::build - // // echo "\r\n" . json_encode(xdebug_get_headers()) . "\r\n"; - // Response::redirect($url, $params); - - // $this->assertContains('Location: ' . $url, xdebug_get_headers()); - } - - /** - * @#runInSeparateProcess - * @covers think\Response::header - * @todo Implement testHeader(). - */ - public function testHeader() - { - // $name = "Location"; - // $url = "http://www.testheader.com/"; - // Response::header($name, $url); - // $this->assertContains($name . ': ' . $url, xdebug_get_headers()); - } - }