public function testRenderLocationWithTemplate($isInline, $deniedException, array $configResolverParams, array $loggerParams, $templateEngineTemplate, $renderTemplate, $renderResult)
{
$renderer = $this->getMockedRenderer(array('render', 'checkLocation'));
$locationId = 42;
$viewType = 'embedTest';
$parameters = array('parameters');
$mockLocation = $this->getMock('eZ\\Publish\\API\\Repository\\Values\\Content\\Location');
if (isset($deniedException)) {
$renderer->expects($this->once())->method('checkLocation')->with($locationId)->will($this->throwException($deniedException));
} else {
$mockLocation->expects($this->once())->method('__get')->with('invisible')->will($this->returnValue(false));
$renderer->expects($this->once())->method('checkLocation')->with($locationId)->will($this->returnValue($mockLocation));
}
if (!isset($renderTemplate)) {
$renderer->expects($this->never())->method('render');
} else {
$renderer->expects($this->once())->method('render')->with($renderTemplate, $parameters)->will($this->returnValue($renderResult));
}
if (!isset($templateEngineTemplate)) {
$this->templateEngineMock->expects($this->never())->method($this->anything());
} else {
$this->templateEngineMock->expects($this->once())->method('exists')->with($templateEngineTemplate)->will($this->returnValue(true));
}
if (empty($configResolverParams)) {
$this->configResolverMock->expects($this->never())->method($this->anything());
} else {
$i = 0;
foreach ($configResolverParams as $params) {
$method = $params[0];
$namespace = $params[1];
$returnValue = $params[2];
$this->configResolverMock->expects($this->at($i))->method($method)->with($namespace)->will($this->returnValue($returnValue));
++$i;
}
}
if (empty($loggerParams)) {
$this->loggerMock->expects($this->never())->method($this->anything());
} else {
$i = 0;
foreach ($loggerParams as $params) {
$method = $params[0];
$message = $params[1];
$this->loggerMock->expects($this->at($i))->method($method)->with($message);
++$i;
}
}
$this->assertEquals($renderResult, $renderer->renderLocationEmbed($locationId, $viewType, $parameters, $isInline));
}