mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-07-07 07:12:47 +08:00
修正单元测试
This commit is contained in:
@@ -321,9 +321,9 @@ class App
|
|||||||
throw new Exception('url suffix deny');
|
throw new Exception('url suffix deny');
|
||||||
}
|
}
|
||||||
|
|
||||||
$_SERVER['PATH_INFO'] = $request->path();
|
$path = $request->path();
|
||||||
$depr = $config['pathinfo_depr'];
|
$depr = $config['pathinfo_depr'];
|
||||||
$result = false;
|
$result = false;
|
||||||
// 路由检测
|
// 路由检测
|
||||||
if (APP_ROUTE_ON && !empty($config['url_route_on'])) {
|
if (APP_ROUTE_ON && !empty($config['url_route_on'])) {
|
||||||
// 开启路由
|
// 开启路由
|
||||||
@@ -332,7 +332,7 @@ class App
|
|||||||
Route::import($config['route']);
|
Route::import($config['route']);
|
||||||
}
|
}
|
||||||
// 路由检测(根据路由定义返回不同的URL调度)
|
// 路由检测(根据路由定义返回不同的URL调度)
|
||||||
$result = Route::check($request, $_SERVER['PATH_INFO'], $depr, !IS_CLI ? $config['url_domain_deploy'] : false);
|
$result = Route::check($request, $path, $depr, !IS_CLI ? $config['url_domain_deploy'] : false);
|
||||||
if (APP_ROUTE_MUST && false === $result && $config['url_route_must']) {
|
if (APP_ROUTE_MUST && false === $result && $config['url_route_must']) {
|
||||||
// 路由无效
|
// 路由无效
|
||||||
throw new Exception('route not define ');
|
throw new Exception('route not define ');
|
||||||
@@ -340,7 +340,7 @@ class App
|
|||||||
}
|
}
|
||||||
if (false === $result) {
|
if (false === $result) {
|
||||||
// 路由无效默认分析为模块/控制器/操作/参数...方式URL
|
// 路由无效默认分析为模块/控制器/操作/参数...方式URL
|
||||||
$result = Route::parseUrl($_SERVER['PATH_INFO'], $depr);
|
$result = Route::parseUrl($path, $depr);
|
||||||
}
|
}
|
||||||
//保证$_REQUEST正常取值
|
//保证$_REQUEST正常取值
|
||||||
$_REQUEST = array_merge($_POST, $_GET, $_COOKIE);
|
$_REQUEST = array_merge($_POST, $_GET, $_COOKIE);
|
||||||
|
|||||||
@@ -87,12 +87,10 @@ class appTest extends \PHPUnit_Framework_TestCase
|
|||||||
// 类method调度
|
// 类method调度
|
||||||
public function testInvokeMethod()
|
public function testInvokeMethod()
|
||||||
{
|
{
|
||||||
$_GET = ['thinkphp'];
|
$result = App::invokeMethod(['tests\thinkphp\library\think\AppInvokeMethodTestClass', 'run'], ['thinkphp']);
|
||||||
$result = App::invokeMethod(['tests\thinkphp\library\think\AppInvokeMethodTestClass', 'run']);
|
|
||||||
$this->assertEquals('thinkphp', $result);
|
$this->assertEquals('thinkphp', $result);
|
||||||
|
|
||||||
$_GET = ['thinkphp'];
|
$result = App::invokeMethod('tests\thinkphp\library\think\AppInvokeMethodTestClass::staticRun', ['thinkphp']);
|
||||||
$result = App::invokeMethod('tests\thinkphp\library\think\AppInvokeMethodTestClass::staticRun');
|
|
||||||
$this->assertEquals('thinkphp', $result);
|
$this->assertEquals('thinkphp', $result);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user