8
8
use Magento \Framework \App \Filesystem \DirectoryList ;
9
9
use Magento \ImportExport \Model \Import \ErrorProcessing \ProcessingErrorAggregatorInterface ;
10
10
11
+ /**
12
+ * Test for CustomerComposite import class
13
+ */
11
14
class CustomerCompositeTest extends \PHPUnit \Framework \TestCase
12
15
{
13
16
/**#@+
@@ -129,15 +132,26 @@ protected function _assertCustomerData(array $expectedData)
129
132
* @param string $sourceFile
130
133
* @param array $dataBefore
131
134
* @param array $dataAfter
135
+ * @param int $updatedItemsCount
136
+ * @param int $createdItemsCount
137
+ * @param int $deletedItemsCount
132
138
* @param array $errors
133
139
*
134
140
* @magentoDataFixture Magento/Customer/_files/import_export/customers_for_address_import.php
135
141
* @magentoAppIsolation enabled
136
142
*
137
143
* @dataProvider importDataDataProvider
138
144
*/
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
+ ) {
141
155
\Magento \TestFramework \Helper \Bootstrap::getInstance ()
142
156
->loadArea (\Magento \Framework \App \Area::AREA_FRONTEND );
143
157
// set entity adapter parameters
@@ -173,6 +187,9 @@ public function testImportData($behavior, $sourceFile, array $dataBefore, array
173
187
174
188
// import data
175
189
$ this ->_entityAdapter ->importData ();
190
+ $ this ->assertSame ($ updatedItemsCount , $ this ->_entityAdapter ->getUpdatedItemsCount ());
191
+ $ this ->assertSame ($ createdItemsCount , $ this ->_entityAdapter ->getCreatedItemsCount ());
192
+ $ this ->assertSame ($ deletedItemsCount , $ this ->_entityAdapter ->getDeletedItemsCount ());
176
193
177
194
// assert data after import
178
195
$ this ->_assertCustomerData ($ dataAfter );
@@ -192,6 +209,10 @@ public function importDataDataProvider()
192
209
'$sourceFile ' => $ filesDirectory . self ::DELETE_FILE_NAME ,
193
210
'$dataBefore ' => $ this ->_beforeImport ,
194
211
'$dataAfter ' => [],
212
+ '$updatedItemsCount ' => 0 ,
213
+ '$createdItemsCount ' => 0 ,
214
+ '$deletedItemsCount ' => 1 ,
215
+ '$errors ' => [],
195
216
],
196
217
];
197
218
@@ -200,6 +221,9 @@ public function importDataDataProvider()
200
221
'$sourceFile ' => $ filesDirectory . self ::UPDATE_FILE_NAME ,
201
222
'$dataBefore ' => $ this ->_beforeImport ,
202
223
'$dataAfter ' => $ this ->_afterImport ,
224
+ '$updatedItemsCount ' => 1 ,
225
+ '$createdItemsCount ' => 3 ,
226
+ '$deletedItemsCount ' => 0 ,
203
227
'$errors ' => [],
204
228
];
205
229
0 commit comments