public function ContentAwareGeneratorTest::testGenerateRouteMultilang

File

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

Class

ContentAwareGeneratorTest

Namespace

Symfony\Cmf\Component\Routing\Tests\Routing

Code

public function testGenerateRouteMultilang() {
  $route_en = $this
    ->buildMock('Symfony\\Cmf\\Component\\Routing\\Tests\\Routing\\RouteMock', array(
    'getDefaults',
    'compile',
    'getRouteContent',
  ));
  $route_en
    ->setLocale('en');
  $route_de = $this->routeDocument;
  $route_de
    ->setLocale('de');
  $this->contentDocument
    ->expects($this
    ->once())
    ->method('getRoutes')
    ->will($this
    ->returnValue(array(
    $route_en,
    $route_de,
  )));
  $route_en
    ->expects($this
    ->once())
    ->method('getRouteContent')
    ->will($this
    ->returnValue($this->contentDocument));
  $route_en
    ->expects($this
    ->never())
    ->method('compile');
  $route_de
    ->expects($this
    ->once())
    ->method('compile')
    ->will($this
    ->returnValue($this->routeCompiled));
  $this
    ->assertEquals('result_url', $this->generator
    ->generate($route_en, array(
    '_locale' => 'de',
  )));
}