Skip to content

Commit

Permalink
fix(lumen): undefined method on getRoutes() on lumen 5.5 (#5230)
Browse files Browse the repository at this point in the history
  • Loading branch information
lendormi authored and DavertMik committed Oct 16, 2018
1 parent 84e14d4 commit d12b735
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions src/Codeception/Module/Lumen.php
Expand Up @@ -220,16 +220,18 @@ public function amOnRoute($routeName, $params = [])
*/
private function getRouteByName($routeName)
{
foreach ($this->app->getRoutes() as $route) {
if ($route['method'] != 'GET') {
return;
}

if (isset($this->app->router) && $this->app->router instanceof \Laravel\Lumen\Routing\Router) {
$router = $this->app->router;
} else {
// backward compatibility with lumen 5.3
$router = $this->app;
}
foreach ($router->getRoutes() as $route) {
if (isset($route['action']['as']) && $route['action']['as'] == $routeName) {
return $route;
}
}

$this->fail("Route with name '$routeName' does not exist");
return null;
}

Expand Down

0 comments on commit d12b735

Please sign in to comment.