public function ChainRouterTest::testMatchWithRequestMatchers in Zircon Profile 8.0
Same name and namespace in other branches
- 8 vendor/symfony-cmf/routing/Tests/Routing/ChainRouterTest.php \Symfony\Cmf\Component\Routing\Tests\Routing\ChainRouterTest::testMatchWithRequestMatchers()
Call match on ChainRouter that has RequestMatcher in the chain.
File
- vendor/
symfony-cmf/ routing/ Tests/ Routing/ ChainRouterTest.php, line 269
Class
Namespace
Symfony\Cmf\Component\Routing\Tests\RoutingCode
public function testMatchWithRequestMatchers() {
$url = '/test';
list($low) = $this
->createRouterMocks();
$high = $this
->getMock('Symfony\\Cmf\\Component\\Routing\\Tests\\Routing\\RequestMatcher');
$high
->expects($this
->once())
->method('matchRequest')
->with($this
->callback(function (Request $r) use ($url) {
return $r
->getPathInfo() === $url;
}))
->will($this
->throwException(new \Symfony\Component\Routing\Exception\ResourceNotFoundException()));
$low
->expects($this
->once())
->method('match')
->with($url)
->will($this
->returnValue(array(
'test',
)));
$this->router
->add($low, 10);
$this->router
->add($high, 20);
$result = $this->router
->match($url);
$this
->assertEquals(array(
'test',
), $result);
}