You are here

public function ChainRouterTest::testGenerate 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::testGenerate()

File

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

Class

ChainRouterTest

Namespace

Symfony\Cmf\Component\Routing\Tests\Routing

Code

public function testGenerate() {
  $url = '/test';
  $name = 'test';
  $parameters = array(
    'test' => 'value',
  );
  list($lower, $low, $high) = $this
    ->createRouterMocks();
  $high
    ->expects($this
    ->once())
    ->method('generate')
    ->with($name, $parameters, false)
    ->will($this
    ->throwException(new RouteNotFoundException()));
  $low
    ->expects($this
    ->once())
    ->method('generate')
    ->with($name, $parameters, false)
    ->will($this
    ->returnValue($url));
  $lower
    ->expects($this
    ->never())
    ->method('generate');
  $this->router
    ->add($low, 10);
  $this->router
    ->add($high, 100);
  $result = $this->router
    ->generate($name, $parameters);
  $this
    ->assertEquals($url, $result);
}