public function it_cannot_find_group(Route $route) { $route->getAction()->willReturn('FooController::test'); $route->getVerb()->willReturn('GET'); $route->getUrl()->willReturn('123/345'); $this->add($route); $this->findGroupByRoute($route)->shouldReturn(false); }
/** * @param Route $route * @return bool */ public function routeIsRegistered($route) { foreach ($this->route_objects as $route_object) { if ($route->getUrl() == $route_object->getUrl()) { return true; } } return false; }
public function it_can_add_route_groups() { $group = new RouteGroup([Route::get('/yolo', 'Foo::bar'), Route::get('/fomo', 'Foo::bar')], 'tomorrow'); $this->beConstructedWith([], 'today'); $this->addGroup($group); $this->updateRoutes(); $routes = $this->getRoutes(); $routes->shouldBeArray(); $routes[0]->getUrl()->shouldEqual('today/tomorrow/yolo'); }
public function outputRoute($name, $parameters = []) { if (isset($this->namedRoutes[$name])) { $route = $this->namedRoutes[$name]; } elseif ($this->inferRoute($name) !== false) { $route = $this->inferRoute($name); } else { throw new BadRouteException('Route Not Found or Does Not have Name'); } return Route::get($route, null, $this->base_url, $parameters); }
/** * @param Route $route */ public function add(Route $route) { parent::addRoute($route->getVerb(), $route->getUrl(), $route->getAction()); $this->route_objects[] = $route; return $this; }