Use with Invoked Controllers
Closed this issue · 2 comments
gofish543 commented
Issue: The assertActionUsesMiddleware does not work with invoke methods
Resolution: Change the following lines [52-53] in assertActionUsesMiddleware
$route = $router->getRoutes()->getByAction($controller . '@' . $method);
to
if($method) {
$route = $router->getRoutes()->getByAction($controller . '@' . $method);
}
else {
$route = $router->getRoutes()->getByAction($controller);
}
Then the usage would be $this->assertActionUsesMiddleware ('Controller', 'Method', 'Middleware');
for a method and $this->assertActionUsesMiddleware ('Controller', '', 'Middleware');
for invoked controllers
jasonmccreary commented
Thanks for reporting this. I believe the current solution would be to pass Controller@__invoke
.
However, I will take a closer look.
gofish543 commented
Sorry for the 22 day response, but thank you for the update and release! Really helpful code here.