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());
 }
 /**
  * Test Address::validateRow() with delete action
  *
  * @covers \Magento\CustomerImportExport\Model\Import\Address::validateRow
  * @dataProvider validateRowForDeleteDataProvider
  *
  * @param array $rowData
  * @param array $errors
  * @param boolean $isValid
  * @SuppressWarnings(PHPMD.UnusedFormalParameter)
  */
 public function testValidateRowForDelete(array $rowData, array $errors, $isValid = false)
 {
     $this->_model->setParameters(['behavior' => \Magento\ImportExport\Model\Import::BEHAVIOR_DELETE]);
     if ($isValid) {
         $this->assertTrue($this->_model->validateRow($rowData, 0));
     } else {
         $this->assertFalse($this->_model->validateRow($rowData, 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]));
 }
Example #4
0
 /**
  * Test Mage_ImportExport_Model_Import_Entity_Eav_Customer_Address::validateRow() with delete action
  *
  * @covers Mage_ImportExport_Model_Import_Entity_Eav_Customer_Address::validateRow
  * @dataProvider validateRowForDeleteDataProvider
  *
  * @param array $rowData
  * @param array $errors
  * @param boolean $isValid
  */
 public function testValidateRowForDelete(array $rowData, array $errors, $isValid = false)
 {
     $this->_model->setParameters(array('behavior' => Mage_ImportExport_Model_Import::BEHAVIOR_DELETE));
     if ($isValid) {
         $this->assertTrue($this->_model->validateRow($rowData, 0));
     } else {
         $this->assertFalse($this->_model->validateRow($rowData, 0));
     }
     $this->assertAttributeEquals($errors, '_errors', $this->_model);
 }
 public function testValidateRowForDelete()
 {
     // _validateRowForDelete should be called only once
     $this->_model->expects($this->once())->method('_validateRowForDelete');
     // delete action
     $this->_model->setParameters(['behavior' => \Magento\ImportExport\Model\Import::BEHAVIOR_DELETE]);
     $this->_clearValidatedRows();
     $this->assertAttributeEquals([], '_validatedRows', $this->_model);
     $this->assertTrue($this->_model->validateRow([], 2));
     $this->assertAttributeEquals([2 => true], '_validatedRows', $this->_model);
     $this->assertAttributeEquals(1, '_processedEntitiesCount', $this->_model);
     $this->assertTrue($this->_model->validateRow([], 2));
 }