public function ChainRouterTest::testMatchWithRequestMatchers

Call match on ChainRouter that has RequestMatcher in the chain.

File

drupal/core/vendor/symfony-cmf/routing/Symfony/Cmf/Component/Routing/Tests/Routing/ChainRouterTest.php, line 241

Class

ChainRouterTest

Namespace

Symfony\Cmf\Component\Routing\Tests\Routing

Code

public function testMatchWithRequestMatchers() {
  $url = '/test';
  $request = Request::create('/test');
  list($low) = $this
    ->createRouterMocks();
  $high = $this
    ->getMock('Symfony\\Cmf\\Component\\Routing\\Tests\\Routing\\RequestMatcher');
  $high
    ->expects($this
    ->once())
    ->method('matchRequest')
    ->with($request)
    ->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);
}