public function match(RequestInterface $request, $pathOffset = null, array $options = array()) { $routeMatch = parent::match($request, $pathOffset, $options); /* @var callable $test */ $test = $this->defaults['test']; $result = $test($request, $this->getServiceManager()); return $result ? $routeMatch : null; }
/** * @dataProvider routeProvider * @param Literal $route * @param string $path * @param integer $offset * @param boolean $shouldMatch */ public function testMatching(Literal $route, $path, $offset, $shouldMatch) { $request = new Request(); $request->setUri('http://example.com' . $path); $match = $route->match($request, $offset); if (!$shouldMatch) { $this->assertNull($match); } else { $this->assertInstanceOf('Zend\\Mvc\\Router\\Http\\RouteMatch', $match); if ($offset === null) { $this->assertEquals(strlen($path), $match->getLength()); } } }
public function testNoMatchWithoutUriMethod() { $route = new Literal('/foo'); $request = new BaseRequest(); $this->assertNull($route->match($request)); }
/** * @group ZF2-436 */ public function testEmptyLiteral() { $request = new Request(); $route = new Literal(''); $this->assertNull($route->match($request, 0)); }