@@ -155,6 +155,11 @@ class AddressTest extends TestCase
155
155
*/
156
156
private $ configShare ;
157
157
158
+ /**
159
+ * @var Storage
160
+ */
161
+ private $ customerStorage ;
162
+
158
163
/**
159
164
* Init entity adapter model
160
165
*/
@@ -205,7 +210,7 @@ protected function _getModelDependencies()
205
210
->getMock ();
206
211
$ connection = $ this ->createMock (\stdClass::class);
207
212
$ attributeCollection = $ this ->_createAttrCollectionMock ();
208
- $ customerStorage = $ this ->_createCustomerStorageMock ();
213
+ $ this -> customerStorage = $ this ->_createCustomerStorageMock ();
209
214
$ customerEntity = $ this ->_createCustomerEntityMock ();
210
215
$ addressCollection = new Collection (
211
216
$ this ->createMock (EntityFactory::class)
@@ -229,7 +234,7 @@ protected function _getModelDependencies()
229
234
'bunch_size ' => 1 ,
230
235
'attribute_collection ' => $ attributeCollection ,
231
236
'entity_type_id ' => 1 ,
232
- 'customer_storage ' => $ customerStorage ,
237
+ 'customer_storage ' => $ this -> customerStorage ,
233
238
'customer_entity ' => $ customerEntity ,
234
239
'address_collection ' => $ addressCollection ,
235
240
'entity_table ' => 'not_used ' ,
@@ -465,6 +470,33 @@ public function testValidateRowForUpdate(array $rowData, array $errors, $isValid
465
470
}
466
471
}
467
472
473
+ /**
474
+ * @dataProvider validateRowForUpdateDataProvider
475
+ *
476
+ * @param array $rowData
477
+ * @param array $errors
478
+ * @param boolean $isValid
479
+ * @SuppressWarnings(PHPMD.UnusedFormalParameter)
480
+ */
481
+ public function testValidateRowForUpdateGlobalCustomer (array $ rowData , array $ errors , $ isValid = false )
482
+ {
483
+ $ this ->_model ->setParameters (['behavior ' => Import::BEHAVIOR_ADD_UPDATE ]);
484
+
485
+ $ this ->configShare ->expects ($ this ->once ())
486
+ ->method ('isGlobalScope ' )
487
+ ->willReturn (true );
488
+
489
+ $ this ->customerStorage ->expects ($ this ->once ())
490
+ ->method ('getCustomerIdByEmail ' )
491
+ ->willReturn (1 );
492
+
493
+ if ($ isValid ) {
494
+ $ this ->assertTrue ($ this ->_model ->validateRow ($ rowData , 0 ));
495
+ } else {
496
+ $ this ->assertFalse ($ this ->_model ->validateRow ($ rowData , 0 ));
497
+ }
498
+ }
499
+
468
500
/**
469
501
* Test Address::validateRow()
470
502
* with 2 rows with identical PKs in case when add/update behavior is performed
0 commit comments