public function testRenderContentEmbedAccessDenied() { $renderer = $this->getMockedRenderer(array('render', 'checkContent', 'getEmbedTemplateName')); $contentId = 42; $viewType = 'embedTest'; $templateName = 'templateName'; $parameters = array('parameters'); $isInline = true; $isDenied = true; $result = 'result'; $renderer->expects($this->once())->method('checkContent')->with($contentId)->will($this->throwException(new AccessDeniedException())); $renderer->expects($this->once())->method('render')->with($templateName, $parameters)->will($this->returnValue($result)); $renderer->expects($this->once())->method('getEmbedTemplateName')->with(Renderer::RESOURCE_TYPE_CONTENT, $isInline, $isDenied)->will($this->returnValue($templateName)); $this->templateEngineMock->expects($this->once())->method('exists')->with($templateName)->will($this->returnValue(true)); $this->loggerMock->expects($this->once())->method('error')->with("Could not render embedded resource: access denied to embed Content #{$contentId}"); $this->assertEquals($result, $renderer->renderContentEmbed($contentId, $viewType, $parameters, $isInline)); }