Пример #1
0
 /**
  * @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\Location\Configured::getView
  */
 public function testGetViewLocation()
 {
     $template = 'my_template.html.twig';
     $configHash = array('match' => array(), 'template' => $template);
     $this->matcherFactoryMock->expects($this->once())->method('match')->will($this->returnValue($configHash));
     $lvp = new LocationViewProvider($this->matcherFactoryMock);
     $view = $lvp->getView($this->getMock('eZ\\Publish\\API\\Repository\\Values\\Content\\Location'), '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());
 }
Пример #2
0
 /**
  * Returns the matcher object either from a service identifier or from a class.
  *
  * @param string $matcherIdentifier If it is a service identifier, the matcher will be built with the service container.
  *
  * @return \eZ\Publish\Core\MVC\Symfony\View\ContentViewProvider\Configured\Matcher
  */
 protected function getMatcher($matcherIdentifier)
 {
     if ($this->container->has($matcherIdentifier)) {
         return $this->container->get($matcherIdentifier);
     }
     return parent::getMatcher($matcherIdentifier);
 }
 /**
  * @covers eZ\Publish\Core\MVC\Symfony\View\Provider\Location\Configured::match
  * @expectedException \InvalidArgumentException
  */
 public function testMatchWrongValueObject()
 {
     $matcherMock = $this->getMock('eZ\\Publish\\Core\\MVC\\Symfony\\View\\ContentViewProvider\\Configured\\Matcher');
     $locationMock = $this->getMock('eZ\\Publish\\API\\Repository\\Values\\Content\\ContentInfo');
     $lvp = new LocationViewProvider($this->getRepositoryMock(), array());
     $lvp->match($matcherMock, $locationMock);
 }