You are here

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

File

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

Class

ChainRouterTest

Namespace

Symfony\Cmf\Component\Routing\Tests\Routing

Code

public function testGenerateObjectName() {
  $name = new \stdClass();
  $parameters = array(
    'test' => 'value',
  );
  $defaultRouter = $this
    ->getMock('Symfony\\Component\\Routing\\RouterInterface');
  $chainedRouter = $this
    ->getMock('Symfony\\Cmf\\Component\\Routing\\Tests\\Routing\\VersatileRouter');
  $defaultRouter
    ->expects($this
    ->never())
    ->method('generate');
  $chainedRouter
    ->expects($this
    ->once())
    ->method('supports')
    ->will($this
    ->returnValue(true));
  $chainedRouter
    ->expects($this
    ->once())
    ->method('generate')
    ->with($name, $parameters, false)
    ->will($this
    ->returnValue($name));
  $this->router
    ->add($defaultRouter, 200);
  $this->router
    ->add($chainedRouter, 100);
  $result = $this->router
    ->generate($name, $parameters);
  $this
    ->assertEquals($name, $result);
}