改进Route类存储结构

This commit is contained in:
thinkphp
2016-07-05 18:58:58 +08:00
parent 5e6fba1920
commit 433df8c6ff
3 changed files with 151 additions and 148 deletions

View File

@@ -39,7 +39,7 @@ class routeTest extends \PHPUnit_Framework_TestCase
Route::any('user/:id', 'index/user');
$result = Route::check($request, 'hello/thinkphp');
$this->assertEquals([null, 'index', 'hello'], $result['module']);
$this->assertEquals(['hello/:name' => ['route' => 'index/hello', 'option' => [], 'pattern' => []]], Route::getRules('GET'));
$this->assertEquals(['hello/:name' => ['hello/:name', 'index/hello', ['name' => 1], [], []]], Route::getRules('GET'));
Route::rule('type/:name', 'index/type', 'PUT|POST');
}