public function testCollect()
 {
     $event = new MvcEvent();
     $layoutModel = new ViewModel();
     $layoutModel->setTemplate('layout/2cols-left');
     $event->setViewModel($layoutModel);
     $testBlock = new ViewModel();
     $testBlock->setTemplate('widget1');
     $testBlock->setCaptureTo('sidebarLeft');
     $testBlock2 = new ViewModel();
     $testBlock2->setOption('parent', 'test.block');
     $testBlock2->setTemplate('widget1');
     $this->blockPool->add('test.block', $testBlock);
     $this->blockPool->add('test.block2', $testBlock2);
     $this->collector->collect($event);
     $this->assertEquals('layout/2cols-left', $this->collector->getLayoutTemplate());
     $this->assertInternalType('array', $this->collector->getHandles());
     $this->assertContainsOnlyInstancesOf(HandleInterface::class, $this->collector->getHandles());
     $this->assertInternalType('array', $this->collector->getBlocks());
     $blocks = $this->collector->getBlocks();
     $testBlockArray = current($blocks);
     $testBlock2Array = array_pop($blocks);
     $this->assertEquals('test.block::content', $testBlock2Array['capture_to']);
     $this->assertContains('_files/view/widget1.phtml', $testBlockArray['template']);
     $this->assertEquals('sidebarLeft', $testBlockArray['capture_to']);
     $this->assertEquals(ViewModel::class, $testBlockArray['class']);
     $this->assertEquals(LayoutUpdaterInterface::AREA_DEFAULT, $this->collector->getCurrentArea());
     $this->assertInternalType('array', $this->collector->getLayoutStructure());
 }
 public function testCollect()
 {
     $event = new MvcEvent();
     $layoutModel = new ViewModel();
     $layoutModel->setTemplate('layout/2cols-left');
     $event->setViewModel($layoutModel);
     $testBlock = new ViewModel();
     $testBlock->setTemplate('test/block');
     $testBlock->setCaptureTo('sidebarLeft');
     $this->layout->addBlock('test.block', $testBlock);
     $this->collector->collect($event);
     $this->assertEquals('layout/2cols-left', $this->collector->getLayoutTemplate());
     $this->assertInternalType('array', $this->collector->getHandles());
     $this->assertContainsOnlyInstancesOf('ConLayout\\Handle\\HandleInterface', $this->collector->getHandles());
     $this->assertInternalType('array', $this->collector->getBlocks());
     $testBlockArray = current($this->collector->getBlocks());
     $this->assertEquals('test/block', $testBlockArray['template']);
     $this->assertEquals('sidebarLeft', $testBlockArray['capture_to']);
     $this->assertEquals('Zend\\View\\Model\\ViewModel', $testBlockArray['class']);
     $this->assertInternalType('array', $this->collector->getLayoutStructure());
 }