Ouzo\Routing\Route::group PHP Method

group() public static method

public static group ( $name, $routeFunction )
    public static function group($name, $routeFunction)
    {
        GroupedRoute::setGroupName($name);
        $routeFunction();
    }

Usage Example

Example #1
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());
 }