Exemple #1
0
 /**
  * Test whether correct methods are invoked in case of custom behaviour for each row in action column
  *
  * @covers Mage_ImportExport_Model_Import_Entity_Eav_Customer::_importData
  */
 public function testImportDataWithCustomBehaviour()
 {
     $this->_model = $this->_getModelMockForTestImportDataWithCustomBehaviour();
     $this->_model->setParameters(array('behavior' => Mage_ImportExport_Model_Import::BEHAVIOR_CUSTOM));
     // validation in validateSaveCustomerEntities and validateDeleteCustomerEntities
     $this->_model->importData();
 }
 /**
  * Check customer email validation for delete behavior
  *
  * @covers Mage_ImportExport_Model_Import_Entity_Eav_Customer::validateRow
  */
 public function testValidateEmailForDeleteBehavior()
 {
     $this->_customerData[Mage_ImportExport_Model_Import_Entity_Eav_Customer::COLUMN_EMAIL] = '*****@*****.**';
     $this->_model->setParameters(array('behavior' => Mage_ImportExport_Model_Import::BEHAVIOR_DELETE));
     $this->_model->validateRow($this->_customerData, 0);
     $this->assertGreaterThan(0, $this->_model->getErrorsCount());
     $this->assertArrayHasKey(Mage_ImportExport_Model_Import_Entity_Eav_Customer::ERROR_CUSTOMER_NOT_FOUND, $this->_model->getErrorMessages());
 }
Exemple #3
0
 /**
  * Set data from outside to change behavior
  *
  * @param array $parameters
  * @return Mage_ImportExport_Model_Import_Entity_CustomerComposite
  */
 public function setParameters(array $parameters)
 {
     parent::setParameters($parameters);
     if ($this->getBehavior() == Mage_ImportExport_Model_Import::BEHAVIOR_APPEND) {
         $parameters['behavior'] = Mage_ImportExport_Model_Import::BEHAVIOR_ADD_UPDATE;
     }
     $this->_customerEntity->setParameters($parameters);
     $this->_addressEntity->setParameters($parameters);
     return $this;
 }
 /**
  * Test importData() method (delete behavior)
  *
  * @covers Mage_ImportExport_Model_Import_Entity_Eav_Customer::_importData
  * @covers Mage_ImportExport_Model_Import_Entity_Eav_Customer::_deleteCustomers
  *
  * @magentoDataFixture Mage/ImportExport/_files/customers.php
  */
 public function testDeleteData()
 {
     $source = new Mage_ImportExport_Model_Import_Source_Csv(__DIR__ . '/_files/customers_to_import.csv');
     /** @var $customerCollection Mage_Customer_Model_Resource_Customer_Collection */
     $customerCollection = Mage::getResourceModel('Mage_Customer_Model_Resource_Customer_Collection');
     $this->assertEquals(3, $customerCollection->count(), 'Count of existing customers are invalid');
     $this->_model->setParameters(array('behavior' => Mage_ImportExport_Model_Import::BEHAVIOR_DELETE))->setSource($source)->isDataValid();
     $this->_model->importData();
     $customerCollection->resetData();
     $customerCollection->clear();
     $this->assertEmpty($customerCollection->count(), 'Customers were not imported');
 }