@@ -146,6 +146,7 @@ protected function setUp()
146
146
$ this ->initializedProductMock = $ this ->getMock (
147
147
'Magento\Catalog\Model\Product ' ,
148
148
[
149
+ 'getWebsiteIds ' ,
149
150
'setProductOptions ' ,
150
151
'load ' ,
151
152
'getOptions ' ,
@@ -444,6 +445,8 @@ public function testSaveExisting()
444
445
->expects ($ this ->once ())
445
446
->method ('toNestedArray ' )
446
447
->will ($ this ->returnValue ($ this ->productData ));
448
+ $ this ->productMock ->expects ($ this ->once ())->method ('getWebsiteIds ' )->willReturn ([]);
449
+
447
450
$ this ->assertEquals ($ this ->productMock , $ this ->model ->save ($ this ->productMock ));
448
451
}
449
452
@@ -462,6 +465,8 @@ public function testSaveNew()
462
465
->expects ($ this ->once ())
463
466
->method ('toNestedArray ' )
464
467
->will ($ this ->returnValue ($ this ->productData ));
468
+ $ this ->productMock ->expects ($ this ->once ())->method ('getWebsiteIds ' )->willReturn ([]);
469
+
465
470
$ this ->assertEquals ($ this ->productMock , $ this ->model ->save ($ this ->productMock ));
466
471
}
467
472
@@ -484,6 +489,8 @@ public function testSaveUnableToSaveException()
484
489
->expects ($ this ->once ())
485
490
->method ('toNestedArray ' )
486
491
->will ($ this ->returnValue ($ this ->productData ));
492
+ $ this ->productMock ->expects ($ this ->once ())->method ('getWebsiteIds ' )->willReturn ([]);
493
+
487
494
$ this ->model ->save ($ this ->productMock );
488
495
}
489
496
@@ -507,6 +514,8 @@ public function testSaveException()
507
514
->expects ($ this ->once ())
508
515
->method ('toNestedArray ' )
509
516
->will ($ this ->returnValue ($ this ->productData ));
517
+ $ this ->productMock ->expects ($ this ->once ())->method ('getWebsiteIds ' )->willReturn ([]);
518
+
510
519
$ this ->model ->save ($ this ->productMock );
511
520
}
512
521
@@ -528,6 +537,8 @@ public function testSaveInvalidProductException()
528
537
->expects ($ this ->once ())
529
538
->method ('toNestedArray ' )
530
539
->will ($ this ->returnValue ($ this ->productData ));
540
+ $ this ->productMock ->expects ($ this ->once ())->method ('getWebsiteIds ' )->willReturn ([]);
541
+
531
542
$ this ->model ->save ($ this ->productMock );
532
543
}
533
544
@@ -732,6 +743,8 @@ public function testSaveExistingWithOptions(array $newOptions, array $existingOp
732
743
->method ('setProductOptions ' )
733
744
->with ($ expectedData );
734
745
746
+ $ this ->initializedProductMock ->expects ($ this ->once ())->method ('getWebsiteIds ' )->willReturn ([]);
747
+
735
748
$ this ->assertEquals ($ this ->initializedProductMock , $ this ->model ->save ($ this ->productMock ));
736
749
}
737
750
@@ -963,6 +976,7 @@ public function testSaveWithLinks(array $newLinks, array $existingLinks, array $
963
976
$ outputLinks [] = $ outputLink ;
964
977
}
965
978
}
979
+ $ this ->initializedProductMock ->expects ($ this ->once ())->method ('getWebsiteIds ' )->willReturn ([]);
966
980
967
981
$ results = $ this ->model ->save ($ this ->initializedProductMock );
968
982
$ this ->assertEquals ($ this ->initializedProductMock , $ results );
@@ -1131,6 +1145,7 @@ public function testSaveExistingWithNewMediaGalleryEntries()
1131
1145
'media_type ' => 'media_type ' ,
1132
1146
]
1133
1147
);
1148
+ $ this ->initializedProductMock ->expects ($ this ->once ())->method ('getWebsiteIds ' )->willReturn ([]);
1134
1149
1135
1150
$ this ->model ->save ($ this ->productMock );
1136
1151
}
@@ -1206,6 +1221,7 @@ public function testSaveExistingWithMediaGalleryEntries()
1206
1221
$ galleryAttributeBackendMock ->expects ($ this ->once ())
1207
1222
->method ('setMediaAttribute ' )
1208
1223
->with ($ this ->initializedProductMock , ['image ' , 'small_image ' ], 'filename1 ' );
1224
+ $ this ->initializedProductMock ->expects ($ this ->once ())->method ('getWebsiteIds ' )->willReturn ([]);
1209
1225
1210
1226
$ this ->model ->save ($ this ->productMock );
1211
1227
$ this ->assertEquals ($ expectedResult , $ this ->initializedProductMock ->getMediaGallery ('images ' ));
0 commit comments