public function testToHtmlPropagatesUrl() { \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\\Framework\\App\\State')->setAreaCode('frontend'); $this->_block->setShouldPrepareInfoTabs(true); $childOne = $this->_layout->addBlock('Magento\\Framework\\View\\Element\\Text', 'child1', 'block'); $this->_layout->addToParentGroup('child1', 'info_tabs'); $childTwo = $this->_layout->addBlock('Magento\\Framework\\View\\Element\\Text', 'child2', 'block'); $this->_layout->addToParentGroup('child2', 'info_tabs'); $this->assertEmpty($childOne->getViewUrl()); $this->assertEmpty($childTwo->getViewUrl()); $this->_block->toHtml(); $this->assertNotEmpty($childOne->getViewUrl()); $this->assertNotEmpty($childTwo->getViewUrl()); }
/** * @magentoAppIsolation enabled * @covers \Magento\Framework\View\Element\AbstractBlock::getGroupChildNames * @covers \Magento\Framework\View\Layout::addToParentGroup */ public function testAddToParentGroup() { $parent = $this->_createBlockWithLayout('parent', 'parent'); $block1 = $this->_createBlockWithLayout('block1', 'block1'); $block2 = $this->_createBlockWithLayout('block2', 'block2'); $parent->setChild('block1', $block1)->setChild('block2', $block2); $this->_layout->addToParentGroup('block1', 'group'); $this->_layout->addToParentGroup('block2', 'group'); $group = $parent->getGroupChildNames('group'); $this->assertContains('block1', $group); $this->assertContains('block2', $group); $this->assertSame($group[0], 'block1'); $this->assertSame($group[1], 'block2'); }