@@ -446,9 +446,8 @@ public function testAfterImportData()
446
446
[$ this ->products [0 ][ImportProduct::COL_SKU ]],
447
447
[$ this ->products [1 ][ImportProduct::COL_SKU ]]
448
448
)->willReturn ([]);
449
- $ getProductWebsitesCallsCount = $ productsCount * 2 ;
450
449
$ this ->importProduct
451
- ->expects ($ this ->exactly ($ getProductWebsitesCallsCount ))
450
+ ->expects ($ this ->exactly (3 ))
452
451
->method ('getProductWebsites ' )
453
452
->willReturnOnConsecutiveCalls (
454
453
[$ newSku [0 ]['entity_id ' ] => $ websiteId ],
@@ -495,14 +494,13 @@ public function testAfterImportData()
495
494
$ newSku [1 ]['entity_id ' ]
496
495
);
497
496
$ product
498
- ->expects ($ this ->exactly ($ productsCount ))
497
+ ->expects ($ this ->exactly (1 ))
499
498
->method ('getSku ' )
500
499
->will ($ this ->onConsecutiveCalls (
501
- $ this ->products [0 ]['sku ' ],
502
- $ this ->products [1 ]['sku ' ]
500
+ $ this ->products [0 ]['sku ' ]
503
501
));
504
502
$ product
505
- ->expects ($ this ->exactly ($ productsCount ))
503
+ ->expects ($ this ->any ($ productsCount ))
506
504
->method ('getStoreId ' )
507
505
->will ($ this ->onConsecutiveCalls (
508
506
$ this ->products [0 ][ImportProduct::COL_STORE ],
@@ -520,7 +518,7 @@ public function testAfterImportData()
520
518
->method ('create ' )
521
519
->willReturn ($ product );
522
520
$ this ->connection
523
- ->expects ($ this ->exactly (4 ))
521
+ ->expects ($ this ->exactly (2 ))
524
522
->method ('quoteInto ' )
525
523
->withConsecutive (
526
524
[
@@ -562,8 +560,9 @@ public function testAfterImportData()
562
560
$ this ->urlRewrite ->expects ($ this ->any ())->method ('setRequestPath ' )->willReturnSelf ();
563
561
$ this ->urlRewrite ->expects ($ this ->any ())->method ('setTargetPath ' )->willReturnSelf ();
564
562
$ this ->urlRewrite ->expects ($ this ->any ())->method ('getTargetPath ' )->willReturn ('targetPath ' );
563
+ $ this ->urlRewrite ->expects ($ this ->any ())->method ('setUrlSuffix ' )->willReturnSelf ();
565
564
$ this ->urlRewrite ->expects ($ this ->any ())->method ('getStoreId ' )
566
- ->willReturnOnConsecutiveCalls (0 , 'not global ' );
565
+ ->willReturnOnConsecutiveCalls (0 , 'not global ' , 0 , ' not global ' );
567
566
568
567
$ this ->urlRewriteFactory ->expects ($ this ->any ())->method ('create ' )->willReturn ($ this ->urlRewrite );
569
568
@@ -685,13 +684,17 @@ public function testCanonicalUrlRewriteGenerateWithUrlPath()
685
684
->method ('getUrlPathWithSuffix ' )
686
685
->will ($ this ->returnValue ($ requestPath ));
687
686
$ this ->productUrlPathGenerator
688
- ->expects ($ this ->once ())
687
+ ->expects ($ this ->any ())
689
688
->method ('getUrlPath ' )
690
689
->will ($ this ->returnValue ('urlPath ' ));
691
690
$ this ->productUrlPathGenerator
692
691
->expects ($ this ->once ())
693
692
->method ('getCanonicalUrlPath ' )
694
693
->will ($ this ->returnValue ($ targetPath ));
694
+ $ this ->productUrlPathGenerator
695
+ ->expects ($ this ->once ())
696
+ ->method ('getUrlSuffix ' )
697
+ ->will ($ this ->returnValue ('.html ' ));
695
698
$ this ->urlRewrite
696
699
->expects ($ this ->once ())
697
700
->method ('setStoreId ' )
@@ -717,6 +720,16 @@ public function testCanonicalUrlRewriteGenerateWithUrlPath()
717
720
->method ('setTargetPath ' )
718
721
->with ($ targetPath )
719
722
->will ($ this ->returnSelf ());
723
+ $ this ->urlRewrite
724
+ ->expects ($ this ->once ())
725
+ ->method ('setStoreId ' )
726
+ ->with (10 )
727
+ ->will ($ this ->returnSelf ());
728
+ $ this ->urlRewrite
729
+ ->expects ($ this ->once ())
730
+ ->method ('setUrlSuffix ' )
731
+ ->with ('.html ' )
732
+ ->will ($ this ->returnSelf ());
720
733
$ this ->urlRewriteFactory
721
734
->expects ($ this ->once ())
722
735
->method ('create ' )
@@ -796,6 +809,10 @@ public function testCategoriesUrlRewriteGenerate()
796
809
->expects ($ this ->any ())
797
810
->method ('getCanonicalUrlPath ' )
798
811
->will ($ this ->returnValue ($ canonicalUrlPathWithCategory ));
812
+ $ this ->productUrlPathGenerator
813
+ ->expects ($ this ->any ())
814
+ ->method ('getUrlSuffix ' )
815
+ ->will ($ this ->returnValue ('.html ' ));
799
816
$ category = $ this ->getMock ('Magento\Catalog\Model\Category ' , [], [], '' , false );
800
817
$ category
801
818
->expects ($ this ->any ())
@@ -831,6 +848,11 @@ public function testCategoriesUrlRewriteGenerate()
831
848
->method ('setMetadata ' )
832
849
->with (['category_id ' => $ this ->categoryId ])
833
850
->will ($ this ->returnSelf ());
851
+ $ this ->urlRewrite
852
+ ->expects ($ this ->any ())
853
+ ->method ('setUrlSuffix ' )
854
+ ->with ('.html ' )
855
+ ->will ($ this ->returnSelf ());
834
856
$ this ->urlRewriteFactory
835
857
->expects ($ this ->any ())
836
858
->method ('create ' )
0 commit comments