Inheritance: implements Ouzo\Routing\RouteInterface
Exemplo n.º 1
0
 /**
  * @test
  */
 public function shouldCreateRouteForResource()
 {
     //given
     GroupedRoute::resource('users');
     //when
     $routes = Route::getRoutes();
     //then
     Assert::thatArray($routes)->onMethod('getUri')->containsOnly('/api/users', '/api/users/fresh', '/api/users/:id/edit', '/api/users/:id', '/api/users', '/api/users/:id', '/api/users/:id', '/api/users/:id');
 }
Exemplo n.º 2
0
 public static function group($name, $routeFunction)
 {
     GroupedRoute::setGroupName($name);
     $routeFunction();
 }
Exemplo n.º 3
0
 /**
  * @test
  */
 public function shouldAddRouteInGroup()
 {
     //given
     Route::group('api', function () {
         GroupedRoute::post('/users/:id/archive', 'users#archive');
     });
     //when
     $routes = Route::getRoutes();
     //then
     $this->assertCount(1, $routes);
     $this->assertEquals('/api/users/:id/archive', $routes[0]->getUri());
     $this->assertEquals('archive', $routes[0]->getAction());
     $this->assertEquals('api/users', $routes[0]->getController());
     $this->assertEquals('POST', $routes[0]->getMethod());
 }