Skip to content

Commit fb0baa5

Browse files
author
Oleksandr Iegorov
committed
MAGETWO-87570: "Hide from Product Page" option does not work for child of configurable product
1 parent 54ebd25 commit fb0baa5

File tree

1 file changed

+15
-7
lines changed

1 file changed

+15
-7
lines changed

app/code/Magento/Swatches/Test/Unit/Helper/DataTest.php

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,9 @@ protected function setUp()
6464
{
6565
$this->objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this);
6666
$this->imageHelperMock = $this->createMock(\Magento\Catalog\Helper\Image::class);
67+
$this->imageHelperMock->expects($this->any())
68+
->method('init')
69+
->willReturn($this->imageHelperMock);
6770
$this->productCollectionFactoryMock = $this->createPartialMock(
6871
\Magento\Catalog\Model\ResourceModel\Product\CollectionFactory::class,
6972
['create']
@@ -375,19 +378,19 @@ public function testGetProductMediaGallery($mediaGallery, $image)
375378
[$this->productMock, 'product_page_image_medium', [], $this->imageHelperMock],
376379
[$this->productMock, 'product_page_image_small', [], $this->imageHelperMock],
377380
]);
378-
$this->imageHelperMock->expects($this->atLeastOnce())
381+
$this->imageHelperMock->expects($this->any())
379382
->method('setImageFile')
380383
->willReturnSelf();
381-
$this->imageHelperMock->expects($this->atLeastOnce())
384+
$this->imageHelperMock->expects($this->any())
382385
->method('constrainOnly')
383386
->willReturnSelf();
384-
$this->imageHelperMock->expects($this->atLeastOnce())
387+
$this->imageHelperMock->expects($this->any())
385388
->method('keepAspectRatio')
386389
->willReturnSelf();
387-
$this->imageHelperMock->expects($this->atLeastOnce())
390+
$this->imageHelperMock->expects($this->any())
388391
->method('keepFrame')
389392
->willReturnSelf();
390-
$this->imageHelperMock->expects($this->atLeastOnce())
393+
$this->imageHelperMock->expects($this->any())
391394
->method('getUrl')
392395
->willReturnMap($mediaUrls);
393396
}
@@ -448,13 +451,18 @@ protected function getUsedProducts(array $attributes, array $imageTypes)
448451

449452
$simpleProducts = [];
450453
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(
452460
\Magento\Catalog\Model\Product::class,
453461
['hasData', 'getMediaGalleryEntries'],
454462
[],
455463
'',
456464
false
457-
);
465+
);*/
458466
$simpleProduct->setData($attributes);
459467

460468
$mediaGalleryEntries = [];

0 commit comments

Comments
 (0)