You are here

public function ChainRouterTest::testGenerateObjectNotFoundVersatile in Zircon Profile 8

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

A versatile router will generate the debug message.

@expectedException \Symfony\Component\Routing\Exception\RouteNotFoundException

File

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

Class

ChainRouterTest

Namespace

Symfony\Cmf\Component\Routing\Tests\Routing

Code

public function testGenerateObjectNotFoundVersatile() {
  $name = new \stdClass();
  $parameters = array(
    'test' => 'value',
  );
  $chainedRouter = $this
    ->getMock('Symfony\\Cmf\\Component\\Routing\\Tests\\Routing\\VersatileRouter');
  $chainedRouter
    ->expects($this
    ->once())
    ->method('supports')
    ->will($this
    ->returnValue(true));
  $chainedRouter
    ->expects($this
    ->once())
    ->method('generate')
    ->with($name, $parameters, false)
    ->will($this
    ->throwException(new RouteNotFoundException()));
  $chainedRouter
    ->expects($this
    ->once())
    ->method('getRouteDebugMessage')
    ->with($name, $parameters)
    ->will($this
    ->returnValue('message'));
  $this->router
    ->add($chainedRouter, 10);
  $this->router
    ->generate($name, $parameters);
}