Skip to content

Commit 920296a

Browse files
committed
Merge branch 'MAGETWO-99894' of https://github.com/magento-tango/magento2ce into pr_2019_06_11_ce
2 parents bb3cede + 2673005 commit 920296a

File tree

2 files changed

+30
-2
lines changed

2 files changed

+30
-2
lines changed

app/code/Magento/CustomerImportExport/Model/Import/CustomerComposite.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -270,6 +270,10 @@ protected function _initAddressAttributes()
270270
protected function _importData()
271271
{
272272
$result = $this->_customerEntity->importData();
273+
$this->countItemsCreated += $this->_customerEntity->getCreatedItemsCount();
274+
$this->countItemsUpdated += $this->_customerEntity->getUpdatedItemsCount();
275+
$this->countItemsDeleted += $this->_customerEntity->getDeletedItemsCount();
276+
273277
if ($this->getBehavior() != \Magento\ImportExport\Model\Import::BEHAVIOR_DELETE) {
274278
return $result && $this->_addressEntity->setCustomerAttributes($this->_customerAttributes)->importData();
275279
}

dev/tests/integration/testsuite/Magento/CustomerImportExport/Model/Import/CustomerCompositeTest.php

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@
88
use Magento\Framework\App\Filesystem\DirectoryList;
99
use Magento\ImportExport\Model\Import\ErrorProcessing\ProcessingErrorAggregatorInterface;
1010

11+
/**
12+
* Test for CustomerComposite import class
13+
*/
1114
class CustomerCompositeTest extends \PHPUnit\Framework\TestCase
1215
{
1316
/**#@+
@@ -129,15 +132,26 @@ protected function _assertCustomerData(array $expectedData)
129132
* @param string $sourceFile
130133
* @param array $dataBefore
131134
* @param array $dataAfter
135+
* @param int $updatedItemsCount
136+
* @param int $createdItemsCount
137+
* @param int $deletedItemsCount
132138
* @param array $errors
133139
*
134140
* @magentoDataFixture Magento/Customer/_files/import_export/customers_for_address_import.php
135141
* @magentoAppIsolation enabled
136142
*
137143
* @dataProvider importDataDataProvider
138144
*/
139-
public function testImportData($behavior, $sourceFile, array $dataBefore, array $dataAfter, array $errors = [])
140-
{
145+
public function testImportData(
146+
$behavior,
147+
$sourceFile,
148+
array $dataBefore,
149+
array $dataAfter,
150+
$updatedItemsCount,
151+
$createdItemsCount,
152+
$deletedItemsCount,
153+
array $errors = []
154+
) {
141155
\Magento\TestFramework\Helper\Bootstrap::getInstance()
142156
->loadArea(\Magento\Framework\App\Area::AREA_FRONTEND);
143157
// set entity adapter parameters
@@ -173,6 +187,9 @@ public function testImportData($behavior, $sourceFile, array $dataBefore, array
173187

174188
// import data
175189
$this->_entityAdapter->importData();
190+
$this->assertSame($updatedItemsCount, $this->_entityAdapter->getUpdatedItemsCount());
191+
$this->assertSame($createdItemsCount, $this->_entityAdapter->getCreatedItemsCount());
192+
$this->assertSame($deletedItemsCount, $this->_entityAdapter->getDeletedItemsCount());
176193

177194
// assert data after import
178195
$this->_assertCustomerData($dataAfter);
@@ -192,6 +209,10 @@ public function importDataDataProvider()
192209
'$sourceFile' => $filesDirectory . self::DELETE_FILE_NAME,
193210
'$dataBefore' => $this->_beforeImport,
194211
'$dataAfter' => [],
212+
'$updatedItemsCount' => 0,
213+
'$createdItemsCount' => 0,
214+
'$deletedItemsCount' => 1,
215+
'$errors' => [],
195216
],
196217
];
197218

@@ -200,6 +221,9 @@ public function importDataDataProvider()
200221
'$sourceFile' => $filesDirectory . self::UPDATE_FILE_NAME,
201222
'$dataBefore' => $this->_beforeImport,
202223
'$dataAfter' => $this->_afterImport,
224+
'$updatedItemsCount' => 1,
225+
'$createdItemsCount' => 3,
226+
'$deletedItemsCount' => 0,
203227
'$errors' => [],
204228
];
205229

0 commit comments

Comments
 (0)