eZ\Publish\Core\MVC\Symfony\FieldType\Tests\RichText\RendererTest::testRenderLocationEmbedAccessDenied PHP Метод

testRenderLocationEmbedAccessDenied() публичный Метод

    public function testRenderLocationEmbedAccessDenied()
    {
        $renderer = $this->getMockedRenderer(array('render', 'checkLocation', 'getEmbedTemplateName'));
        $locationId = 42;
        $viewType = 'embedTest';
        $templateName = 'templateName';
        $parameters = array('parameters');
        $isInline = true;
        $isDenied = true;
        $result = 'result';
        $renderer->expects($this->once())->method('checkLocation')->with($locationId)->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_LOCATION, $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 Location #{$locationId}");
        $this->assertEquals($result, $renderer->renderLocationEmbed($locationId, $viewType, $parameters, $isInline));
    }