Exemplo n.º 1
0
 /**
  * @return RoutePattern
  */
 private function getRoutePattern()
 {
     $routePattern = new RoutePattern($this->uriPattern);
     $routePattern->setMethod($this->method);
     $routePattern->setContentType($this->contentType);
     return $routePattern;
 }
 private function getRoute($uri, $method, $contentType)
 {
     $routePattern = new RoutePattern($uri);
     $routePattern->setMethod($method);
     $routePattern->setContentType($contentType);
     return new Route($routePattern, function () {
     });
 }
Exemplo n.º 3
0
 public function testFindWithFilterWithDynamicParams()
 {
     $routePattern1 = new RoutePattern('this/one');
     $routePattern1->addFilter(function ($result) {
         return $result;
     });
     $routes = array(new Route($routePattern1, function () {
         return true;
     }));
     $request = new RequestMock();
     $request->setRequestUri('this/one');
     $routeFinder = new RouteFinder(new Container(['result' => true]));
     $controller = $routeFinder->find($request, $routes)->getController();
     $this->assertTrue($controller());
 }