mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-07-01 12:42:48 +08:00
修正单元测试
This commit is contained in:
@@ -82,21 +82,12 @@ class responseTest extends \PHPUnit_Framework_TestCase
|
||||
$dataArr["key"] = "value";
|
||||
|
||||
$response = Response::create($dataArr, 'json');
|
||||
$result = $response->send();
|
||||
$result = $response->getContent();
|
||||
$this->assertEquals('{"key":"value"}', $result);
|
||||
$_GET['callback'] = 'callback';
|
||||
$response = Response::create($dataArr, 'jsonp');
|
||||
$result = $response->options(['var_jsonp_handler' => 'callback'])->send();
|
||||
$result = $response->options(['var_jsonp_handler' => 'callback'])->getContent();
|
||||
$this->assertEquals('callback({"key":"value"});', $result);
|
||||
|
||||
$response = new Response();
|
||||
$response->transform(function () {
|
||||
|
||||
return "callbackreturndata";
|
||||
});
|
||||
$result = $response->send($dataArr);
|
||||
$this->assertEquals("callbackreturndata", $result);
|
||||
$_GET[Config::get('var_jsonp_handler')] = "";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user