From bd0968b4076159993d94838d57093041545c2c50 Mon Sep 17 00:00:00 2001 From: thinkphp Date: Mon, 5 Sep 2016 16:07:14 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E8=BF=9BRequest=E7=B1=BB=E8=8E=B7?= =?UTF-8?q?=E5=8F=96=E5=BD=93=E5=89=8D=E8=AF=B7=E6=B1=82=E7=9A=84=E6=8E=A7?= =?UTF-8?q?=E5=88=B6=E5=99=A8=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- library/think/App.php | 2 +- tests/thinkphp/library/think/requestTest.php | 13 +------------ 2 files changed, 2 insertions(+), 13 deletions(-) diff --git a/library/think/App.php b/library/think/App.php index d10945f5..59df8ba8 100644 --- a/library/think/App.php +++ b/library/think/App.php @@ -327,7 +327,7 @@ class App $actionName = $convert ? strtolower($actionName) : $actionName; // 设置当前请求的控制器、操作 - $request->controller($controller)->action($actionName); + $request->controller(Loader::parseName($controller, 1))->action($actionName); // 监听module_init Hook::listen('module_init', $request); diff --git a/tests/thinkphp/library/think/requestTest.php b/tests/thinkphp/library/think/requestTest.php index 25cf094d..a37fdf78 100644 --- a/tests/thinkphp/library/think/requestTest.php +++ b/tests/thinkphp/library/think/requestTest.php @@ -150,7 +150,7 @@ class requestTest extends \PHPUnit_Framework_TestCase $this->assertFalse($request->has('user_id')); $this->assertTrue($request->has('test', 'request')); $this->assertEquals(['id' => 6], $request->only('id')); - $this->assertEquals(['name' => 'thinkphp'], $request->except('id')); + $this->assertEquals(['name' => 'thinkphp', 'lang' => 'zh-cn'], $request->except('id')); $this->assertEquals('THINKPHP', $request->param('name', '', 'strtoupper')); } @@ -175,15 +175,4 @@ class requestTest extends \PHPUnit_Framework_TestCase $this->assertTrue($request->isMobile()); } - public function testRouteInfo() - { - Config::set('app_multi_module', true); - $request = new Request(); - $request->url('/hello/thinkphp'); - Route::rule('hello/:name', 'index/hello'); - Route::check($request, $request->url()); - $this->assertEquals('', $request->module()); - $this->assertEquals('index', $request->controller()); - $this->assertEquals('hello', $request->action()); - } }