public function testPathValidator()
 {
     $validator = new PathValidator();
     $route = $this->getCollection()->get('page');
     $this->assertFalse($validator->match($route, RequestContextFactory::createHttpGet('/page/NEWS-TITLE/1')));
     $this->assertFalse($validator->match($route, RequestContextFactory::createHttpGet('/page/news-title/abc')));
     $this->assertTrue($validator->match($route, RequestContextFactory::createHttpGet('/page/news-title')));
     $this->assertTrue($validator->match($route, RequestContextFactory::createHttpGet('/page/news-title/5')));
 }
 public function testClosureHandler()
 {
     $router = new Router($this->getCollection());
     $test = $this;
     $router->setClosureHandler(function (Route $route = null, RequestContext $request, Router $router, RequestContext $previousRequest = null) use($test) {
         $caller = \Closure::bind($route->getHandler(), null);
         $stmt = $caller($request->getParameter('slug'));
         $test->assertTrue($stmt === 'Page: page-title');
     });
     $router->listen(RequestContextFactory::createHttpGet('/page/page-title'));
 }