File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -296,15 +296,7 @@ public function factory($a = null, $b = null) {
296296 return $ this ->_factory ->objectMap ($ a ,$ b );
297297 }
298298
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 ());
299+ public function __call ($ method , $ args ) {
300+ return call_user_func_array ([$ this ->router (), $ method ], $ args );
309301 }
310302}
Original file line number Diff line number Diff line change @@ -39,11 +39,13 @@ public static function app($app = null) {
3939 }
4040
4141 public static function __callStatic ($ name , $ arguments ) {
42- return (new \ReflectionMethod (self ::app (), $ name ))->invokeArgs (self ::app (), $ arguments );
42+ //return (new \ReflectionMethod(self::app(), $name))->invokeArgs(self::app(), $arguments);
43+ return call_user_func_array ([self ::app (), $ name ], $ arguments );
4344 }
4445
4546 public function __call ($ name , $ arguments ) {
46- return (new \ReflectionMethod (self ::app (), $ name ))->invokeArgs (self ::app (), $ arguments );
47+ //return (new \ReflectionMethod(self::app(), $name))->invokeArgs(self::app(), $arguments);
48+ return call_user_func_array ([self ::app (), $ name ], $ arguments );
4749 }
4850}
4951
Original file line number Diff line number Diff line change @@ -566,4 +566,32 @@ public function testRouterShorthandWhen() {
566566 $ this ->tip ->start ();
567567 $ this ->assertTrue ($ res );
568568 }
569+
570+ public function testRouterShorthandDelete () {
571+ $ _REQUEST ['__url ' ] = 'router/shorthand ' ;
572+ $ _SERVER ['REQUEST_METHOD ' ] = 'DELETE ' ;
573+ $ this ->tip ->delete ('router/shorthand ' , function () use (&$ res ) {
574+ $ res = true ;
575+ });
576+ $ this ->tip ->start ();
577+ $ this ->assertTrue ($ res );
578+ }
579+
580+ public function testRouterShorthandHome () {
581+ $ _REQUEST ['__url ' ] = '' ;
582+ $ this ->tip ->home (function () use (&$ res ) {
583+ $ res = true ;
584+ });
585+ $ this ->tip ->start ();
586+ $ this ->assertTrue ($ res );
587+ }
588+
589+ public function testRouterShorthandOtherwise () {
590+ $ _REQUEST ['__url ' ] = 'router/shorthand ' ;
591+ $ this ->tip ->otherwise (function () use (&$ res ) {
592+ $ res = true ;
593+ });
594+ $ this ->tip ->start ();
595+ $ this ->assertTrue ($ res );
596+ }
569597}
You can’t perform that action at this time.
0 commit comments