You are here

public function ContentAwareGeneratorTest::testGenerateNoContentFoundInRepository in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/symfony-cmf/routing/Tests/Routing/ContentAwareGeneratorTest.php \Symfony\Cmf\Component\Routing\Tests\Routing\ContentAwareGeneratorTest::testGenerateNoContentFoundInRepository()

Generate with content_id but the content is not found.

@expectedException \Symfony\Component\Routing\Exception\RouteNotFoundException

File

vendor/symfony-cmf/routing/Tests/Routing/ContentAwareGeneratorTest.php, line 326

Class

ContentAwareGeneratorTest

Namespace

Symfony\Cmf\Component\Routing\Tests\Routing

Code

public function testGenerateNoContentFoundInRepository() {
  $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(null));
  $this->generator
    ->setContentRepository($contentRepository);
  $this->generator
    ->generate('', array(
    'content_id' => '/content/id',
  ));
}