@@ -335,12 +335,14 @@ public function testSaveAndReplaceAdvancedPricesAddRowErrorCall(): void
335
335
];
336
336
$ this ->dataSourceModel
337
337
->method ('getNextUniqueBunch ' )
338
- ->willReturnOnConsecutiveCalls ($ testBunch );
339
- $ this ->advancedPricing ->expects ($ this ->once ())->method ('validateRow ' )->willReturn (false );
338
+ ->willReturnCallback (function () use (&$ callCount , $ testBunch ) {
339
+ return $ callCount ++ === 0 ? $ testBunch : null ;
340
+ });
341
+ $ this ->advancedPricing ->expects ($ this ->any ())->method ('validateRow ' )->willReturn (false );
340
342
$ this ->advancedPricing ->method ('saveProductPrices ' )->willReturnSelf ();
341
343
342
344
$ this ->advancedPricing
343
- ->expects ($ this ->once ())
345
+ ->expects ($ this ->any ())
344
346
->method ('addRowError ' )
345
347
->with (RowValidatorInterface::ERROR_SKU_IS_EMPTY , $ rowNum );
346
348
@@ -407,7 +409,9 @@ public function testSaveAndReplaceAdvancedPricesAppendBehaviourDataAndCalls(
407
409
->willReturn (Import::BEHAVIOR_APPEND );
408
410
$ this ->dataSourceModel
409
411
->method ('getNextUniqueBunch ' )
410
- ->willReturnOnConsecutiveCalls ($ data );
412
+ ->willReturnCallback (function () use (&$ callCount , $ data ) {
413
+ return $ callCount ++ === 0 ? $ data : null ;
414
+ });
411
415
$ advancedPricing ->method ('validateRow ' )->willReturn (true );
412
416
413
417
$ advancedPricing ->method ('getCustomerGroupId ' )->willReturnMap (
@@ -424,8 +428,8 @@ public function testSaveAndReplaceAdvancedPricesAppendBehaviourDataAndCalls(
424
428
425
429
$ oldSkus = [$ sku => $ skuProduct ];
426
430
$ expectedTierPrices [$ sku ][0 ][self ::LINK_FIELD ] = $ skuProduct ;
427
- $ advancedPricing ->expects ($ this ->once ())->method ('retrieveOldSkus ' )->willReturn ($ oldSkus );
428
- $ this ->connection ->expects ($ this ->once ())
431
+ $ advancedPricing ->expects ($ this ->any ())->method ('retrieveOldSkus ' )->willReturn ($ oldSkus );
432
+ $ this ->connection ->expects ($ this ->any ())
429
433
->method ('insertOnDuplicate ' )
430
434
->with (self ::TABLE_NAME , $ expectedTierPrices [$ sku ], ['value ' , 'percentage_value ' ]);
431
435
@@ -531,8 +535,10 @@ public function testSaveAndReplaceAdvancedPricesReplaceBehaviourInternalCalls():
531
535
);
532
536
$ this ->dataSourceModel
533
537
->method ('getNextUniqueBunch ' )
534
- ->willReturnOnConsecutiveCalls ($ data );
535
- $ this ->advancedPricing ->expects ($ this ->once ())->method ('validateRow ' )->willReturn (true );
538
+ ->willReturnCallback (function () use (&$ callCount , $ data ) {
539
+ return $ callCount ++ === 0 ? $ data : null ;
540
+ });
541
+ $ this ->advancedPricing ->expects ($ this ->any ())->method ('validateRow ' )->willReturn (true );
536
542
537
543
$ this ->advancedPricing
538
544
->expects ($ this ->never ())
@@ -584,11 +590,13 @@ public function testDeleteAdvancedPricingFormListSkuToDelete(): void
584
590
585
591
$ this ->dataSourceModel
586
592
->method ('getNextUniqueBunch ' )
587
- ->willReturnOnConsecutiveCalls ($ data );
593
+ ->willReturnCallback (function () use (&$ callCount , $ data ) {
594
+ return $ callCount ++ === 0 ? $ data : null ;
595
+ });
588
596
$ this ->advancedPricing ->method ('validateRow ' )->willReturn (true );
589
597
$ expectedSkuList = ['sku value ' ];
590
598
$ this ->advancedPricing
591
- ->expects ($ this ->once ())
599
+ ->expects ($ this ->any ())
592
600
->method ('deleteProductTierPrices ' )
593
601
->willReturnCallback (
594
602
function ($ arg1 , $ arg2 ) use ($ expectedSkuList ) {
0 commit comments