Skip to content

Commit cd50669

Browse files
committed
add test testDispatchingCallableActionClasses
1 parent 84b6c7d commit cd50669

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

tests/Routing/RoutingRouteTest.php

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff 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+
}

0 commit comments

Comments
 (0)