public function testRegister() { $request = Request::instance(); Route::get('hello/:name', 'index/hello'); Route::get(['hello/:name' => 'index/hello']); Route::post('hello/:name', 'index/post'); Route::put('hello/:name', 'index/put'); Route::delete('hello/:name', 'index/delete'); Route::patch('hello/:name', 'index/patch'); Route::any('user/:id', 'index/user'); $result = Route::check($request, 'hello/thinkphp'); $this->assertEquals([null, 'index', 'hello'], $result['module']); $this->assertEquals(['hello' => true, 'user/:id' => true, 'hello/:name' => ['rule' => 'hello/:name', 'route' => 'index/hello', 'var' => ['name' => 1], 'option' => [], 'pattern' => []]], Route::rules('GET')); Route::rule('type1/:name', 'index/type', 'PUT|POST'); Route::rule(['type2/:name' => 'index/type1']); Route::rule([['type3/:name', 'index/type2', ['method' => 'POST']]]); Route::rule(['name', 'type4/:name'], 'index/type4'); }