public function testGetOptionHtml() { $option = $this->getMock('\\Magento\\Bundle\\Model\\Option', ['getType', '__wakeup'], [], '', false); $option->expects($this->exactly(1))->method('getType')->will($this->returnValue('checkbox')); $optionBlock = $this->getMock('\\Magento\\Bundle\\Block\\Catalog\\Product\\View\\Type\\Bundle\\Option\\Checkbox', ['setOption', 'toHtml'], [], '', false); $optionBlock->expects($this->any())->method('setOption')->will($this->returnValue($optionBlock)); $optionBlock->expects($this->any())->method('toHtml')->will($this->returnValue('option html')); $layout = $this->getMock('Magento\\Framework\\View\\Layout', ['getChildName', 'getBlock'], [], '', false); $layout->expects($this->any())->method('getChildName')->will($this->returnValue('name')); $layout->expects($this->any())->method('getBlock')->will($this->returnValue($optionBlock)); $this->_bundleBlock->setLayout($layout); $this->assertEquals('option html', $this->_bundleBlock->getOptionHtml($option)); }
/** * {@inheritdoc} */ public function getOptionHtml(\Magento\Bundle\Model\Option $option) { $pluginInfo = $this->pluginList->getNext($this->subjectType, 'getOptionHtml'); if (!$pluginInfo) { return parent::getOptionHtml($option); } else { return $this->___callPlugins('getOptionHtml', func_get_args(), $pluginInfo); } }