/** * @magentoAppIsolation enabled */ public function testProcessWithExceptions() { \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\\Framework\\App\\State')->setMode(State::MODE_DEFAULT); $this->layout->generateElements(); $this->layout->addOutputElement('block.with.broken.constructor'); $this->layout->addOutputElement('block.with.broken.layout'); $this->layout->addOutputElement('block.with.broken.action'); $this->assertEmpty($this->layout->getOutput()); }
/** * {@inheritdoc} */ public function getOutput() { $pluginInfo = $this->pluginList->getNext($this->subjectType, 'getOutput'); if (!$pluginInfo) { return parent::getOutput(); } else { return $this->___callPlugins('getOutput', func_get_args(), $pluginInfo); } }
/** * @covers \Magento\Framework\View\Layout::addOutputElement * @covers \Magento\Framework\View\Layout::getOutput * @covers \Magento\Framework\View\Layout::removeOutputElement */ public function testGetOutput() { $blockName = 'block_' . __METHOD__; $expectedText = "some_text_for_{$blockName}"; $block = $this->_layout->addBlock('Magento\\Framework\\View\\Element\\Text', $blockName); $block->setText($expectedText); $this->_layout->addOutputElement($blockName); // add the same element twice should not produce output duplicate $this->_layout->addOutputElement($blockName); $this->assertEquals($expectedText, $this->_layout->getOutput()); $this->_layout->removeOutputElement($blockName); $this->assertEmpty($this->_layout->getOutput()); }