eZ\Publish\Core\MVC\Symfony\View\Tests\ViewManagerTest::testRenderLocation PHP Method

testRenderLocation() public method

public testRenderLocation ( )
    public function testRenderLocation()
    {
        $content = new Content(['versionInfo' => new VersionInfo(['contentInfo' => new ContentInfo()])]);
        $location = new Location(['contentInfo' => new ContentInfo()]);
        // Configuring view provider behaviour
        $templateIdentifier = 'foo:bar:baz';
        $params = array('foo' => 'bar');
        $this->viewConfigurator->expects($this->once())->method('configure')->will($this->returnCallback(function (View $view) use($templateIdentifier) {
            $view->setTemplateIdentifier($templateIdentifier);
        }));
        $languages = array('eng-GB');
        $this->configResolverMock->expects($this->any())->method('getParameter')->with('languages')->will($this->returnValue($languages));
        $contentService = $this->getMock('eZ\\Publish\\API\\Repository\\ContentService');
        $contentService->expects($this->any())->method('loadContentByContentInfo')->with($location->contentInfo, $languages)->will($this->returnValue($content));
        $this->repositoryMock->expects($this->any())->method('getContentService')->will($this->returnValue($contentService));
        // Configuring template engine behaviour
        $expectedTemplateResult = 'This is location rendering';
        $this->templateEngineMock->expects($this->once())->method('render')->with($templateIdentifier, $params + array('location' => $location, 'content' => $content, 'viewbaseLayout' => $this->viewBaseLayout))->will($this->returnValue($expectedTemplateResult));
        self::assertSame($expectedTemplateResult, $this->viewManager->renderLocation($location, 'customViewType', $params));
    }