You are here

public function ChainRouterTest::testMatchAndNotAllowed in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 vendor/symfony-cmf/routing/Tests/Routing/ChainRouterTest.php \Symfony\Cmf\Component\Routing\Tests\Routing\ChainRouterTest::testMatchAndNotAllowed()

If there is a method not allowed but another router matches, that one is used

File

vendor/symfony-cmf/routing/Tests/Routing/ChainRouterTest.php, line 302

Class

ChainRouterTest

Namespace

Symfony\Cmf\Component\Routing\Tests\Routing

Code

public function testMatchAndNotAllowed() {
  $url = '/test';
  list($low, $high) = $this
    ->createRouterMocks();
  $high
    ->expects($this
    ->once())
    ->method('match')
    ->with($url)
    ->will($this
    ->throwException(new \Symfony\Component\Routing\Exception\MethodNotAllowedException(array())));
  $low
    ->expects($this
    ->once())
    ->method('match')
    ->with($url)
    ->will($this
    ->returnValue(array(
    'test',
  )));
  $this->router
    ->add($low, 10);
  $this->router
    ->add($high, 100);
  $result = $this->router
    ->match('/test');
  $this
    ->assertEquals(array(
    'test',
  ), $result);
}