Example #1
0
 public function testSaveData()
 {
     $associatedSku = 'sku_assoc';
     $productSku = 'productSku';
     $this->entityModel->expects($this->once())->method('getNewSku')->will($this->returnValue([$associatedSku => ['entity_id' => 1], $productSku => ['entity_id' => 2]]));
     $attributes = ['position' => ['id' => 0], 'qty' => ['id' => 0]];
     $this->links->expects($this->once())->method('getAttributes')->will($this->returnValue($attributes));
     $bunch = [['_associated_sku' => $associatedSku, 'sku' => $productSku, '_type' => 'grouped', '_associated_default_qty' => 4, '_associated_position' => 6]];
     $this->entityModel->expects($this->at(0))->method('getNextBunch')->will($this->returnValue($bunch));
     $this->entityModel->expects($this->at(1))->method('getNextBunch')->will($this->returnValue($bunch));
     $this->entityModel->expects($this->any())->method('isRowAllowedToImport')->will($this->returnValue(true));
     $this->entityModel->expects($this->any())->method('getRowScope')->will($this->returnValue(\Magento\CatalogImportExport\Model\Import\Product::SCOPE_DEFAULT));
     $this->links->expects($this->once())->method("saveLinksData");
     $this->grouped->saveData();
 }
Example #2
0
 /**
  * Test saveData() with store row scope
  */
 public function testSaveDataScopeStore()
 {
     $this->entityModel->expects($this->once())->method('getNewSku')->will($this->returnValue(['sku_assoc1' => ['entity_id' => 1], 'productSku' => ['entity_id' => 2, 'attr_set_code' => 'Default', 'type_id' => 'grouped']]));
     $this->entityModel->expects($this->once())->method('getOldSku')->will($this->returnValue(['sku_assoc2' => ['entity_id' => 3]]));
     $attributes = ['position' => ['id' => 0], 'qty' => ['id' => 0]];
     $this->links->expects($this->once())->method('getAttributes')->will($this->returnValue($attributes));
     $bunch = [['associated_skus' => 'sku_assoc1=1, sku_assoc2=2', 'sku' => 'productSku', 'product_type' => 'grouped']];
     $this->entityModel->expects($this->at(2))->method('getNextBunch')->will($this->returnValue($bunch));
     $this->entityModel->expects($this->any())->method('isRowAllowedToImport')->will($this->returnValue(true));
     $this->entityModel->expects($this->at(4))->method('getRowScope')->will($this->returnValue(\Magento\CatalogImportExport\Model\Import\Product::SCOPE_DEFAULT));
     $this->entityModel->expects($this->at(5))->method('getRowScope')->will($this->returnValue(\Magento\CatalogImportExport\Model\Import\Product::SCOPE_STORE));
     $this->links->expects($this->once())->method('saveLinksData');
     $this->grouped->saveData();
 }