Exemple #1
0
 public function testIsRowValidError()
 {
     $rowData = ['_attribute_set' => 'attribute_set_name'];
     $rowNum = 1;
     $this->entityModel->expects($this->any())->method('getRowScope')->willReturn(1);
     $this->entityModel->expects($this->once())->method('addRowError')->with(\Magento\CatalogImportExport\Model\Import\Product\RowValidatorInterface::ERROR_VALUE_IS_REQUIRED, 1, 'attr_code')->willReturnSelf();
     $this->assertFalse($this->simpleType->isRowValid($rowData, $rowNum));
 }
 public function testPrepareAttributesWithDefaultValueForSave()
 {
     $rowData = ['_attribute_set' => 'attributeSetName', 'boolean_attribute' => 'Yes'];
     $result = $this->simpleType->prepareAttributesWithDefaultValueForSave($rowData);
     $this->assertEquals(['boolean_attribute' => 1], $result);
 }
Exemple #3
0
 /**
  * Prepare attributes with default value for save.
  *
  * @param array $rowData
  * @param bool $withDefaultValue
  * @return array
  */
 public function prepareAttributesWithDefaultValueForSave(array $rowData, $withDefaultValue = true)
 {
     $resultAttrs = parent::prepareAttributesWithDefaultValueForSave($rowData, $withDefaultValue);
     $resultAttrs = array_merge($resultAttrs, $this->setWeightVirtualProduct($rowData));
     return $resultAttrs;
 }