public function testToHtmlWithContainer() { $listName = $this->_block->getNameInLayout(); $block1 = $this->_layout->addBlock('Magento\\Framework\\View\\Element\\Text', '', $listName); $this->_layout->addContainer('container', 'Container', [], $listName); $block2 = $this->_layout->addBlock('Magento\\Framework\\View\\Element\\Text', '', 'container'); $block3 = $this->_layout->addBlock('Magento\\Framework\\View\\Element\\Text', '', $listName); $block1->setText('text1'); $block2->setText('text2'); $block3->setText('text3'); $html = $this->_block->toHtml(); $this->assertEquals('text1text2text3', $html); }
/** * @param \Magento\Framework\View\LayoutInterface $layout * @depends testSetChild */ public function testReorderChild(\Magento\Framework\View\LayoutInterface $layout) { $layout->addContainer('four', 'Four', [], 'one'); // offset +1 $layout->reorderChild('one', 'four', 1); $this->assertSame(['two', 'four', 'three'], $layout->getChildNames('one')); // offset -2 $layout->reorderChild('one', 'three', 2, false); $this->assertSame(['two', 'three', 'four'], $layout->getChildNames('one')); // after sibling $layout->reorderChild('one', 'two', 'three'); $this->assertSame(['three', 'two', 'four'], $layout->getChildNames('one')); // after everyone $layout->reorderChild('one', 'three', '-'); $this->assertSame(['two', 'four', 'three'], $layout->getChildNames('one')); // before sibling $layout->reorderChild('one', 'four', 'two', false); $this->assertSame(['four', 'two', 'three'], $layout->getChildNames('one')); // before everyone $layout->reorderChild('one', 'two', '-', false); $this->assertSame(['two', 'four', 'three'], $layout->getChildNames('one')); //reorder by sibling alias $layout->reorderChild('one', 'two', 'three_alias', true); $this->assertSame(['four', 'three', 'two'], $layout->getChildNames('one')); }