getRoutes() public static method

public static getRoutes ( ) : RouteRule[]
return RouteRule[]
Esempio 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');
 }
Esempio n. 2
0
    public function __construct()
    {
        $this->routeRules = $routes = Route::getRoutes();
        $this->generatedFunctions .= 'function checkParameter(parameter) {
' . self::INDENT . 'if (parameter === null) {
' . self::INDENT . self::INDENT . 'throw new Error("Uri helper: Missing parameters");
' . self::INDENT . '}
}' . "\n\n";
        $this->generateFunctions();
    }
Esempio n. 3
0
 /**
  * @return UriHelperGenerator
  */
 public static function generate()
 {
     return new self(Route::getRoutes());
 }
Esempio n. 4
0
 /**
  * @param $path
  * @param $requestType
  * @return RouteRule
  */
 private function findRouteRule($path, $requestType)
 {
     return Arrays::find(Route::getRoutes(), function (RouteRule $rule) use($path, $requestType) {
         return $rule->matches($path, $requestType);
     });
 }
Esempio n. 5
0
 public function createController()
 {
     $routeRule = Arrays::first(Route::getRoutes());
     return SampleController::createInstance($routeRule);
 }
Esempio n. 6
0
 private function all()
 {
     $this->_renderRoutes(Route::getRoutes());
 }
Esempio n. 7
0
 /**
  * @test
  */
 public function shouldAddAllowAll()
 {
     //given
     Route::get('/user', 'User#index');
     Route::allowAll('/user', 'User');
     //when
     $routes = Route::getRoutes();
     //then
     $this->assertCount(2, $routes);
 }