Esempio n. 1
0
 public function testInjectBlocks()
 {
     $layout = new Layout($this->updaterMock, $this->blockPool);
     $layout->attachGenerator('blocks', $this->blocksGenerator);
     $layoutModel = new ViewModel();
     $layout->setRoot($layoutModel);
     $layout->load();
     $this->assertEquals('new/layout', $layoutModel->getTemplate());
     $this->assertCount(3, $layoutModel->getChildren());
     $this->assertCount(1, $layout->getBlock('widget.1')->getChildren());
 }
Esempio n. 2
0
 public function testRemoveAddedBlock()
 {
     $layout = new Layout($this->blockFactory, $this->updaterMock);
     $block = new ViewModel();
     $layout->addBlock('some-block', $block);
     $this->assertSame($block, $layout->getBlock('some-block'));
     $layout->removeBlock('some-block');
     $this->assertFalse($layout->getBlock('some-block'));
 }