/** * Test whether correct methods are invoked in case of custom behaviour for each row in action column */ public function testImportDataWithCustomBehaviour() { $this->_model = $this->_getModelMockForTestImportDataWithCustomBehaviour(); $this->_model->setParameters(['behavior' => \Magento\ImportExport\Model\Import::BEHAVIOR_CUSTOM]); // validation in validateSaveCustomerEntities and validateDeleteCustomerEntities $this->_model->importData(); }
public function testValidateEmailForDeleteBehavior() { $this->_customerData[Customer::COLUMN_EMAIL] = '*****@*****.**'; $this->_model->setParameters(['behavior' => Import::BEHAVIOR_DELETE]); $this->_model->validateRow($this->_customerData, 0); $this->assertGreaterThan(0, $this->_model->getErrorsCount()); $this->assertArrayHasKey(Customer::ERROR_CUSTOMER_NOT_FOUND, $this->_model->getErrorMessages()); }
public function testValidateEmailForDeleteBehavior() { $this->_model->getErrorAggregator()->clear(); $this->_customerData[Customer::COLUMN_EMAIL] = '*****@*****.**'; $this->_model->setParameters(['behavior' => Import::BEHAVIOR_DELETE]); $this->_model->validateRow($this->_customerData, 0); $this->assertGreaterThan(0, $this->_model->getErrorAggregator()->getErrorsCount()); $this->assertNotEmpty($this->_model->getErrorAggregator()->getErrorsByCode([Customer::ERROR_CUSTOMER_NOT_FOUND])); }
/** * Returns number of checked entities * * @return int */ public function getProcessedEntitiesCount() { return $this->_customerEntity->getProcessedEntitiesCount() + $this->_addressEntity->getProcessedEntitiesCount(); }
/** * @inheritDoc */ public function getValidColumnNames() { $this->validColumnNames = array_merge($this->validColumnNames, $this->_customerAttributes, $this->_addressAttributes, $this->_customerEntity->getValidColumnNames()); return $this->validColumnNames; }