public function ChainRouterTest::testGenerateObjectName

File

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

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\\ChainedRouterInterface');
  $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);
}