Пример #1
0
 /**
  * Match if current Route match to the request url, method and type
  *
  * @param Route $route
  * @return bool
  */
 private function match(Route $route)
 {
     if (!in_array($this->routeRequest->getRequestMethod(), $route->getMethods())) {
         return false;
     }
     if (!$this->routeRequest->isAjax() && 'ajax' == $route->getType()) {
         return false;
     }
     if (!preg_match($route->getPattern(), $this->routeRequest->getRequestUrl())) {
         return false;
     }
     return true;
 }
Пример #2
0
 /**
  * @test
  */
 public function shouldUseMethodOverwrite()
 {
     $_SERVER['HTTP_X_HTTP_METHOD_OVERRIDE'] = 'DELETE';
     $request = new RouteRequest();
     $this->assertEquals('DELETE', $request->getRequestMethod());
 }