public function ContentAwareGeneratorTest::testGenerateFromContentId

File

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

Class

ContentAwareGeneratorTest

Namespace

Symfony\Cmf\Component\Routing\Tests\Routing

Code

public function testGenerateFromContentId() {
  $this->provider
    ->expects($this
    ->never())
    ->method('getRouteByName');
  $contentRepository = $this
    ->buildMock("Symfony\\Cmf\\Component\\Routing\\ContentRepositoryInterface", array(
    'findById',
    'getContentId',
  ));
  $contentRepository
    ->expects($this
    ->once())
    ->method('findById')
    ->with('/content/id')
    ->will($this
    ->returnValue($this->contentDocument));
  $this->generator
    ->setContentRepository($contentRepository);
  $this->contentDocument
    ->expects($this
    ->once())
    ->method('getRoutes')
    ->will($this
    ->returnValue(array(
    $this->routeDocument,
  )));
  $this->routeDocument
    ->expects($this
    ->once())
    ->method('compile')
    ->will($this
    ->returnValue($this->routeCompiled));
  $this
    ->assertEquals('result_url', $this->generator
    ->generate('', array(
    'content_id' => '/content/id',
  )));
}