コード例 #1
0
 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));
 }
コード例 #2
0
 /**
  * {@inheritdoc}
  */
 public function setLayout(\Magento\Framework\View\LayoutInterface $layout)
 {
     $pluginInfo = $this->pluginList->getNext($this->subjectType, 'setLayout');
     if (!$pluginInfo) {
         return parent::setLayout($layout);
     } else {
         return $this->___callPlugins('setLayout', func_get_args(), $pluginInfo);
     }
 }