public function setUp()
 {
     parent::setUp();
     $this->updater = new LayoutUpdater();
     $this->em = new EventManager(new SharedEventManager());
     $this->updater->setEventManager($this->em);
     $instructions = [['default', 'frontend', new Config(['blocks' => ['header' => [], 'footer' => []]], true)], ['another-handle', 'frontend', new Config(['blocks' => ['widget1' => []]], true)], ['handle/with-include', 'frontend', new Config(['blocks' => ['do.not.override' => ['remove' => false]], LayoutUpdaterInterface::INSTRUCTION_INCLUDE => ['included/handle']], true)], ['included/handle', 'frontend', new Config(['blocks' => ['some.included.block' => ['template' => 'some/tpl'], 'do.not.override' => ['remove' => true]], LayoutUpdaterInterface::INSTRUCTION_INCLUDE => ['included/handle/no2']], true)], ['included/handle/no2', 'frontend', new Config(['blocks' => ['some.included.block.2' => []]])]];
     $this->em->getSharedManager()->clearListeners(LayoutUpdater::class);
     $collectorMock = $this->getMockBuilder(CollectorInterface::class)->getMock();
     $collectorMock->method('collect')->will($this->returnValueMap($instructions));
     $this->updater->attachCollector('mock', $collectorMock);
 }
Beispiel #2
0
 public function setUp()
 {
     $eventManager = new EventManager();
     $this->layoutUpdater = new LayoutUpdater();
     $this->layoutUpdater->setEventManager($eventManager);
     $this->em = $eventManager;
     $this->em->getSharedManager()->clearListeners('ConLayout\\Updater\\LayoutUpdater');
     $this->em->getSharedManager()->attach('ConLayout\\Updater\\LayoutUpdater', 'getLayoutStructure.pre', function (UpdateEvent $e) {
         $layoutStructure = $e->getLayoutStructure();
         $layoutStructure->merge($this->getLayoutStructure());
     });
     $this->layout = new Layout(new BlockFactory(), $this->layoutUpdater);
 }
Beispiel #3
0
 public function setUp()
 {
     $eventManager = new EventManager();
     $this->layoutUpdater = new LayoutUpdater();
     $this->layoutUpdater->setEventManager($eventManager);
     $this->sm = Bootstrap::getServiceManager();
     $this->em = $eventManager;
     $this->blockPool = new BlockPool();
     $this->blockFactory = new BlockFactory([], new BlockManager(), $this->sm);
     $this->blocksGenerator = new BlocksGenerator($this->blockFactory, $this->blockPool);
     $this->layout = new Layout($this->layoutUpdater, $this->blockPool);
     $this->layout->attachGenerator(BlocksGenerator::NAME, $this->blocksGenerator);
 }