public function testGetBundleOptionsEmptyBundleSelectionIds()
 {
     $optionIds = 'a:1:{i:0;i:1;}';
     $collection = $this->getMock('Magento\\Bundle\\Model\\ResourceModel\\Option\\Collection', [], [], '', false);
     $product = $this->getMock('Magento\\Catalog\\Model\\Product', ['getTypeInstance', '__wakeup'], [], '', false);
     $typeInstance = $this->getMock('Magento\\Bundle\\Model\\Product\\Type', ['getOptionsByIds'], [], '', false);
     $selectionOption = $this->getMock('\\Magento\\Catalog\\Model\\Product\\Configuration\\Item\\Option\\OptionInterface', ['getValue']);
     $itemOption = $this->getMock('\\Magento\\Catalog\\Model\\Product\\Configuration\\Item\\Option\\OptionInterface', ['getValue']);
     $selectionOption->expects($this->once())->method('getValue')->will($this->returnValue(''));
     $itemOption->expects($this->once())->method('getValue')->will($this->returnValue($optionIds));
     $typeInstance->expects($this->once())->method('getOptionsByIds')->with(unserialize($optionIds), $product)->will($this->returnValue($collection));
     $product->expects($this->once())->method('getTypeInstance')->will($this->returnValue($typeInstance));
     $this->item->expects($this->once())->method('getProduct')->will($this->returnValue($product));
     $this->item->expects($this->at(1))->method('getOptionByCode')->with('bundle_option_ids')->will($this->returnValue($itemOption));
     $this->item->expects($this->at(2))->method('getOptionByCode')->with('bundle_selection_ids')->will($this->returnValue($selectionOption));
     $this->assertEquals([], $this->helper->getBundleOptions($this->item));
 }
Example #2
0
 /**
  * Get bundled selections (slections-products collection)
  *
  * Returns array of options objects.
  * Each option object will contain array of selections objects
  *
  * @param bool $useCache
  * @return array
  * @SuppressWarnings(PHPMD.UnusedFormalParameter)
  */
 protected function _getBundleOptions($useCache = true)
 {
     return $this->_configurationHelper->getBundleOptions($this->getItem());
 }