@@ -129,15 +129,15 @@ protected function setUp(): void
129
129
* @param bool $processedFlag
130
130
* @param bool $forceProcess
131
131
* @param int $addressId
132
- * @param int $registeredAddressId
133
- * @param string $configAddressType
132
+ * @param mixed $registeredAddressId
133
+ * @param mixed $configAddressType
134
134
* @dataProvider dataProviderAfterAddressSaveRestricted
135
135
*/
136
136
public function testAfterAddressSaveRestricted (
137
- $ isVatValidationEnabled ,
138
- $ processedFlag ,
139
- $ forceProcess ,
140
- $ addressId ,
137
+ bool $ isVatValidationEnabled ,
138
+ bool $ processedFlag ,
139
+ bool $ forceProcess ,
140
+ int $ addressId ,
141
141
$ registeredAddressId ,
142
142
$ configAddressType
143
143
) {
@@ -303,17 +303,21 @@ public function testAfterAddressSaveException()
303
303
}
304
304
305
305
/**
306
- * @param string $vatId
306
+ * @param mixed $vatId
307
307
* @param int $countryId
308
308
* @param bool $isCountryInEU
309
+ * @param int $customerGroupId
309
310
* @param int $defaultGroupId
311
+ * @param bool $disableAutoGroupChange
310
312
* @dataProvider dataProviderAfterAddressSaveDefaultGroup
311
313
*/
312
314
public function testAfterAddressSaveDefaultGroup (
313
315
$ vatId ,
314
- $ countryId ,
315
- $ isCountryInEU ,
316
- $ defaultGroupId
316
+ int $ countryId ,
317
+ bool $ isCountryInEU ,
318
+ int $ customerGroupId ,
319
+ int $ defaultGroupId ,
320
+ bool $ disableAutoGroupChange
317
321
) {
318
322
$ store = $ this ->getMockBuilder (Store::class)
319
323
->disableOriginalConstructor ()
@@ -340,15 +344,15 @@ public function testAfterAddressSaveDefaultGroup(
340
344
->willReturn ($ store );
341
345
$ customer ->expects ($ this ->once ())
342
346
->method ('getDisableAutoGroupChange ' )
343
- ->willReturn (false );
344
- $ customer ->expects ($ this ->exactly ( 2 ))
347
+ ->willReturn ($ disableAutoGroupChange );
348
+ $ customer ->expects ($ this ->any ( ))
345
349
->method ('getGroupId ' )
346
- ->willReturn (null );
347
- $ customer ->expects ($ this ->once ())
350
+ ->willReturn ($ customerGroupId );
351
+ $ customer ->expects ($ this ->any ())
348
352
->method ('setGroupId ' )
349
353
->with ($ defaultGroupId )
350
354
->willReturnSelf ();
351
- $ customer ->expects ($ this ->once ())
355
+ $ customer ->expects ($ this ->any ())
352
356
->method ('save ' )
353
357
->willReturnSelf ();
354
358
@@ -408,14 +412,17 @@ public function testAfterAddressSaveDefaultGroup(
408
412
public function dataProviderAfterAddressSaveDefaultGroup ()
409
413
{
410
414
return [
411
- ['' , 1 , false , 1 ],
412
- [1 , 1 , false , 1 ],
415
+ 'when vatId is empty, non EU country and disable auto group false ' => ['' , 1 , false , 1 , 1 , false ],
416
+ 'when vatId is empty, non EU country and disable auto group true ' => ['' , 1 , false , 1 , 1 , true ],
417
+ 'when vatId is empty, non EU country, disable auto group true
418
+ and different groupId ' => ['' , 1 , false , 1 , 2 , true ],
419
+ 'when vatId is not empty, non EU country and disable auto group false ' => [1 , 1 , false , 1 , 1 , false ],
413
420
];
414
421
}
415
422
416
423
/**
417
- * @param string $vatId
418
- * @param $vatClass
424
+ * @param mixed $vatId
425
+ * @param mixed $vatClass
419
426
* @param int $countryId
420
427
* @param string $country
421
428
* @param int $newGroupId
@@ -432,15 +439,15 @@ public function dataProviderAfterAddressSaveDefaultGroup()
432
439
public function testAfterAddressSaveNewGroup (
433
440
$ vatId ,
434
441
$ vatClass ,
435
- $ countryId ,
436
- $ country ,
437
- $ newGroupId ,
438
- $ areaCode ,
439
- $ resultVatIsValid ,
440
- $ resultRequestSuccess ,
441
- $ resultValidMessage ,
442
- $ resultInvalidMessage ,
443
- $ resultErrorMessage
442
+ int $ countryId ,
443
+ string $ country ,
444
+ int $ newGroupId ,
445
+ string $ areaCode ,
446
+ bool $ resultVatIsValid ,
447
+ bool $ resultRequestSuccess ,
448
+ string $ resultValidMessage ,
449
+ string $ resultInvalidMessage ,
450
+ string $ resultErrorMessage
444
451
) {
445
452
$ store = $ this ->getMockBuilder (Store::class)
446
453
->disableOriginalConstructor ()
0 commit comments