/** * @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()); }
public function testAddRemoveOutputElement() { $this->assertSame($this->model, $this->model->addOutputElement('name')); $this->assertSame($this->model, $this->model->removeOutputElement('name')); }
/** * {@inheritdoc} */ public function removeOutputElement($name) { $pluginInfo = $this->pluginList->getNext($this->subjectType, 'removeOutputElement'); if (!$pluginInfo) { return parent::removeOutputElement($name); } else { return $this->___callPlugins('removeOutputElement', func_get_args(), $pluginInfo); } }