Beispiel #1
0
 public function testSaveProductRelations()
 {
     $data = [1];
     $typeId = 1;
     $this->model->setData('link_type_id', $typeId);
     $product = $this->getMockBuilder('Magento\\Catalog\\Model\\Product')->disableOriginalConstructor()->setMethods(['getRelatedLinkData', 'getUpSellLinkData', 'getCrossSellLinkData', '__wakeup'])->getMock();
     $product->expects($this->any())->method('getRelatedLinkData')->will($this->returnValue($data));
     $product->expects($this->any())->method('getUpSellLinkData')->will($this->returnValue($data));
     $product->expects($this->any())->method('getCrossSellLinkData')->will($this->returnValue($data));
     $map = [[$product, $data, Link::LINK_TYPE_RELATED, $this->resource], [$product, $data, Link::LINK_TYPE_UPSELL, $this->resource], [$product, $data, Link::LINK_TYPE_CROSSSELL, $this->resource]];
     $this->resource->expects($this->any())->method('saveProductLinks')->will($this->returnValueMap($map));
     $this->model->saveProductRelations($product);
 }
Beispiel #2
0
 public function testSaveProductRelations()
 {
     $product = $this->getMockBuilder('Magento\\Catalog\\Model\\Product')->disableOriginalConstructor()->getMock();
     $this->saveProductLinksMock->expects($this->once())->method('execute')->with(\Magento\Catalog\Api\Data\ProductInterface::class, $product);
     $this->model->saveProductRelations($product);
 }
 /**
  * {@inheritdoc}
  */
 public function saveProductRelations($product)
 {
     $pluginInfo = $this->pluginList->getNext($this->subjectType, 'saveProductRelations');
     if (!$pluginInfo) {
         return parent::saveProductRelations($product);
     } else {
         return $this->___callPlugins('saveProductRelations', func_get_args(), $pluginInfo);
     }
 }