public function testRenderLocationWithContentPassed() { $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', 'content' => $content); $this->viewConfigurator->expects($this->once())->method('configure')->will($this->returnCallback(function (View $view) use($templateIdentifier) { $view->setTemplateIdentifier($templateIdentifier); })); $contentService = $this->getMockBuilder('eZ\\Publish\\Core\\Repository\\ContentService')->disableOriginalConstructor()->getMock(); $contentService->expects($this->any())->method('loadContentByContentInfo')->with($content->contentInfo)->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 + ['location' => $location, 'content' => $content, 'viewbaseLayout' => $this->viewBaseLayout])->will($this->returnValue($expectedTemplateResult)); self::assertSame($expectedTemplateResult, $this->viewManager->renderLocation($location, 'customViewType', $params)); }