/** * @covers \eZ\Publish\Core\MVC\Symfony\View\Provider\Configured::__construct * @covers \eZ\Publish\Core\MVC\Symfony\View\Provider\Configured::buildContentView * @covers \eZ\Publish\Core\MVC\Symfony\View\Provider\Block\Configured::getView */ public function testGetViewContent() { $template = 'my_template.html.twig'; $configHash = array('match' => array(), 'template' => $template); $this->matcherFactoryMock->expects($this->once())->method('match')->will($this->returnValue($configHash)); $cvp = new BlockViewProvider($this->matcherFactoryMock); $view = $cvp->getView($this->getBlockMock(), 'full'); $this->assertInstanceOf('eZ\\Publish\\Core\\MVC\\Symfony\\View\\ContentView', $view); $this->assertSame($configHash, $view->getConfigHash()); $this->assertSame($template, $view->getTemplateIdentifier()); $this->assertSame(array(), $view->getParameters()); }
/** * @expectedException \InvalidArgumentException * * @covers \eZ\Publish\Core\MVC\Symfony\View\Provider\Block\Configured::getView * @covers \eZ\Publish\Core\MVC\Symfony\View\Provider\Block\Configured::getMatcher */ public function testGetViewWrongMatcher() { $bvp = new BlockViewProvider($this->getRepositoryMock(), array('failingMatchBlock' => array('match' => array('wrongMatcher' => 'bibou est un gentil garçon'), 'template' => "mytemplate"))); $bvp->getView($this->getBlockMock(), 'full'); }