Пример #1
0
 /**
  * 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();
 }
Пример #2
0
 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());
 }
Пример #3
0
 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]));
 }
Пример #4
0
 /**
  * Set data from outside to change behavior
  *
  * @param array $parameters
  * @return $this
  */
 public function setParameters(array $parameters)
 {
     parent::setParameters($parameters);
     if ($this->getBehavior() == \Magento\ImportExport\Model\Import::BEHAVIOR_APPEND) {
         $parameters['behavior'] = \Magento\ImportExport\Model\Import::BEHAVIOR_ADD_UPDATE;
     }
     $this->_customerEntity->setParameters($parameters);
     $this->_addressEntity->setParameters($parameters);
     return $this;
 }