File tree Expand file tree Collapse file tree 1 file changed +23
-0
lines changed
Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -898,6 +898,21 @@ public function testRouteRedirect()
898898 }
899899
900900
901+ public function testDispatchingCallableActionClasses ()
902+ {
903+ $ router = $ this ->getRouter ();
904+ $ router ->get ('foo/bar ' , 'ActionStub ' );
905+
906+ $ this ->assertEquals ('hello ' , $ router ->dispatch (Request::create ('foo/bar ' , 'GET ' ))->getContent ());
907+
908+ $ router ->get ('foo/bar2 ' , [
909+ 'uses ' => 'ActionStub ' ,
910+ ]);
911+
912+ $ this ->assertEquals ('hello ' , $ router ->dispatch (Request::create ('foo/bar2 ' , 'GET ' ))->getContent ());
913+ }
914+
915+
901916 protected function getRouter (): Router
902917 {
903918 return new Router (new Illuminate \Events \Dispatcher );
@@ -994,3 +1009,11 @@ public function handle(): string
9941009 return 'handling! ' ;
9951010 }
9961011}
1012+
1013+ class ActionStub extends Controller
1014+ {
1015+ public function __invoke (): string
1016+ {
1017+ return 'hello ' ;
1018+ }
1019+ }
You can’t perform that action at this time.
0 commit comments