public function testRenderContentWithClosure()
{
$content = new Content(['versionInfo' => new VersionInfo(['contentInfo' => new ContentInfo()])]);
// Configuring view provider behaviour
$closure = function ($params) {
return serialize(array_keys($params));
};
$params = ['foo' => 'bar'];
$this->viewConfigurator->expects($this->once())->method('configure')->will($this->returnCallback(function (View $view) use($closure) {
$view->setTemplateIdentifier($closure);
}));
// Configuring template engine behaviour
$params += array('content' => $content, 'viewbaseLayout' => $this->viewBaseLayout);
$expectedTemplateResult = array_keys($params);
$this->templateEngineMock->expects($this->never())->method('render');
$templateResult = unserialize($this->viewManager->renderContent($content, 'full', $params));
sort($expectedTemplateResult);
sort($templateResult);
self::assertEquals($expectedTemplateResult, $templateResult);
}