File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -295,4 +295,16 @@ public function factory($a = null, $b = null) {
295295 }
296296 return $ this ->_factory ->objectMap ($ a ,$ b );
297297 }
298+
299+ public function get () {
300+ return call_user_func_array ([$ this ->router (), 'get ' ], func_get_args ());
301+ }
302+
303+ public function post () {
304+ return call_user_func_array ([$ this ->router (), 'post ' ], func_get_args ());
305+ }
306+
307+ public function when () {
308+ return call_user_func_array ([$ this ->router (), 'when ' ], func_get_args ());
309+ }
298310}
Original file line number Diff line number Diff line change @@ -537,4 +537,33 @@ public function testRouterLibraryControllerParent() {
537537 $ check = $ this ->ob (false );
538538 $ this ->assertEquals ('LIBRARY ' , $ check );
539539 }
540+
541+ public function testRouterShorthandGet () {
542+ $ _REQUEST ['__url ' ] = 'router/shorthand ' ;
543+ $ _SERVER ['REQUEST_METHOD ' ] = 'GET ' ;
544+ $ this ->tip ->get ('router/shorthand ' , function () use (&$ res ) {
545+ $ res = true ;
546+ });
547+ $ this ->tip ->start ();
548+ $ this ->assertTrue ($ res );
549+ }
550+
551+ public function testRouterShorthandPost () {
552+ $ _REQUEST ['__url ' ] = 'router/shorthand ' ;
553+ $ _SERVER ['REQUEST_METHOD ' ] = 'POST ' ;
554+ $ this ->tip ->post ('router/shorthand ' , function () use (&$ res ) {
555+ $ res = true ;
556+ });
557+ $ this ->tip ->start ();
558+ $ this ->assertTrue ($ res );
559+ }
560+
561+ public function testRouterShorthandWhen () {
562+ $ _REQUEST ['__url ' ] = 'router/shorthand ' ;
563+ $ this ->tip ->when ('router/shorthand ' , function () use (&$ res ) {
564+ $ res = true ;
565+ });
566+ $ this ->tip ->start ();
567+ $ this ->assertTrue ($ res );
568+ }
540569}
You can’t perform that action at this time.
0 commit comments