示例#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
 /**
  * Test if correct methods are invoked according to different custom behaviours
  *
  * @covers Mage_ImportExport_Model_Import_Entity_Eav_Customer_Address::_importData
  */
 public function testImportDataWithCustomBehaviour()
 {
     $this->_model = $this->_getModelMockForTestImportDataWithCustomBehaviour();
     $this->_model->setParameters(array('behavior' => Mage_ImportExport_Model_Import::BEHAVIOR_CUSTOM));
     // validation in validateSaveAddressEntities and validateDeleteAddressEntities
     $this->_model->importData();
 }
示例#3
0
 /**
  * Test importData() method (delete behavior)
  *
  * @magentoDataFixture Magento/Customer/_files/import_export/customers.php
  */
 public function testDeleteData()
 {
     \Magento\TestFramework\Helper\Bootstrap::getInstance()->loadArea(\Magento\Framework\App\Area::AREA_FRONTEND);
     $source = new \Magento\ImportExport\Model\Import\Source\Csv(__DIR__ . '/_files/customers_to_import.csv', $this->directoryWrite);
     /** @var $customerCollection \Magento\Customer\Model\Resource\Customer\Collection */
     $customerCollection = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create('Magento\\Customer\\Model\\Resource\\Customer\\Collection');
     $this->assertEquals(3, $customerCollection->count(), 'Count of existing customers are invalid');
     $this->_model->setParameters(['behavior' => Import::BEHAVIOR_DELETE])->setSource($source)->isDataValid();
     $this->_model->importData();
     $customerCollection->resetData();
     $customerCollection->clear();
     $this->assertEmpty($customerCollection->count(), 'Customers were not imported');
 }
示例#4
0
 /**
  * Test for method importData()
  */
 public function testImportData()
 {
     $this->_model->expects($this->once())->method('_importData');
     $this->_model->importData();
 }