/**
  *
  * @param ServiceLocatorInterface $serviceLocator
  * @return BlockRenderer
  */
 public function createService(ServiceLocatorInterface $serviceLocator)
 {
     $blockRenderer = new BlockRenderer();
     $blockRenderer->setHelperPluginManager($serviceLocator->get('ViewHelperManager'));
     $blockRenderer->setResolver($serviceLocator->get('Zend\\View\\Resolver\\AggregateResolver'));
     return $blockRenderer;
 }
 public function setUp()
 {
     $updater = new LayoutUpdater();
     $this->updater = $updater;
     $layout = new Layout(new BlockFactory(), $updater);
     $this->layout = $layout;
     $layout->addBlock('test-block', (new ViewModel())->setTemplate('widget1'));
     $renderer = new BlockRenderer();
     $renderer->setResolver($this->getResolver());
     $this->renderer = $renderer;
     $this->layoutManager = new LayoutManager($layout, $updater, $renderer);
 }
 public function testRenderChildrenAppend()
 {
     $parent = new ViewModel();
     $parent->setTemplate('test');
     $child1 = new ViewModel();
     $child1->setTemplate('test/child1');
     $child2 = new ViewModel();
     $child2->setTemplate('test/child2');
     $parent->addChild($child1, 'childHtml', true);
     $parent->addChild($child2, 'childHtml', true);
     $this->blockRenderer->setCanRenderTrees(true);
     $rendered = $this->blockRenderer->render($parent);
     $this->assertEquals(file_get_contents(__DIR__ . '/../../_files/children-append.html'), $rendered);
 }