@@ -64,6 +64,9 @@ protected function setUp()
64
64
{
65
65
$ this ->objectManager = new \Magento \Framework \TestFramework \Unit \Helper \ObjectManager ($ this );
66
66
$ this ->imageHelperMock = $ this ->createMock (\Magento \Catalog \Helper \Image::class);
67
+ $ this ->imageHelperMock ->expects ($ this ->any ())
68
+ ->method ('init ' )
69
+ ->willReturn ($ this ->imageHelperMock );
67
70
$ this ->productCollectionFactoryMock = $ this ->createPartialMock (
68
71
\Magento \Catalog \Model \ResourceModel \Product \CollectionFactory::class,
69
72
['create ' ]
@@ -375,19 +378,19 @@ public function testGetProductMediaGallery($mediaGallery, $image)
375
378
[$ this ->productMock , 'product_page_image_medium ' , [], $ this ->imageHelperMock ],
376
379
[$ this ->productMock , 'product_page_image_small ' , [], $ this ->imageHelperMock ],
377
380
]);
378
- $ this ->imageHelperMock ->expects ($ this ->atLeastOnce ())
381
+ $ this ->imageHelperMock ->expects ($ this ->any ())
379
382
->method ('setImageFile ' )
380
383
->willReturnSelf ();
381
- $ this ->imageHelperMock ->expects ($ this ->atLeastOnce ())
384
+ $ this ->imageHelperMock ->expects ($ this ->any ())
382
385
->method ('constrainOnly ' )
383
386
->willReturnSelf ();
384
- $ this ->imageHelperMock ->expects ($ this ->atLeastOnce ())
387
+ $ this ->imageHelperMock ->expects ($ this ->any ())
385
388
->method ('keepAspectRatio ' )
386
389
->willReturnSelf ();
387
- $ this ->imageHelperMock ->expects ($ this ->atLeastOnce ())
390
+ $ this ->imageHelperMock ->expects ($ this ->any ())
388
391
->method ('keepFrame ' )
389
392
->willReturnSelf ();
390
- $ this ->imageHelperMock ->expects ($ this ->atLeastOnce ())
393
+ $ this ->imageHelperMock ->expects ($ this ->any ())
391
394
->method ('getUrl ' )
392
395
->willReturnMap ($ mediaUrls );
393
396
}
@@ -448,13 +451,18 @@ protected function getUsedProducts(array $attributes, array $imageTypes)
448
451
449
452
$ simpleProducts = [];
450
453
for ($ i = 0 ; $ i < 2 ; $ i ++) {
451
- $ simpleProduct = $ this ->getMock (
454
+ $ simpleProduct = $ this ->getMockBuilder (\Magento \Catalog \Model \Product::class)
455
+ ->disableOriginalConstructor ()
456
+ ->setMethods (['hasData ' , 'getMediaGalleryEntries ' ])
457
+ ->getMock ();
458
+
459
+ /* $simpleProduct = $this->getMock(
452
460
\Magento\Catalog\Model\Product::class,
453
461
['hasData', 'getMediaGalleryEntries'],
454
462
[],
455
463
'',
456
464
false
457
- );
465
+ );*/
458
466
$ simpleProduct ->setData ($ attributes );
459
467
460
468
$ mediaGalleryEntries = [];
0 commit comments