Пример #1
0
 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);
 }
Пример #2
0
 /**
  * @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;
 }
Пример #3
0
 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');
 }
Пример #4
0
 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);
 }
Пример #5
0
 /**
  * @param Route $route
  */
 public function add(Route $route)
 {
     parent::addRoute($route->getVerb(), $route->getUrl(), $route->getAction());
     $this->route_objects[] = $route;
     return $this;
 }