Skip to content

Commit

Permalink
MAGETWO-8709: [GITHUB] Child product image should be shown in Wishist…
Browse files Browse the repository at this point in the history
… if options are selected for configurable product #8168

- fixing formatting
  • Loading branch information
cpartica committed Jul 17, 2018
1 parent c2c8ef9 commit 525308c
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,15 @@ public function __construct(array $itemResolvers)
*/
public function getFinalProduct(ItemInterface $item) : ProductInterface
{
$product = $item->getProduct();
$finalProduct = $item->getProduct();
foreach ($this->itemResolvers as $resolver) {
$resolvedProduct = $this->getItemResolverInstance($resolver)->getFinalProduct($item);
if ($resolvedProduct !== $product) {
$product = $resolvedProduct;
if ($resolvedProduct !== $finalProduct) {
$finalProduct = $resolvedProduct;
break;
}
}
return $product;
return $finalProduct;
}

/**
Expand All @@ -51,7 +51,7 @@ public function getFinalProduct(ItemInterface $item) : ProductInterface
* @param string $className
* @return ItemResolverInterface
*/
private function getItemResolverInstance(string $className)
private function getItemResolverInstance(string $className) : ItemResolverInterface
{
if (!isset($this->itemResolversInstances[$className])) {
$this->itemResolversInstances[$className] = ObjectManager::getInstance()->get($className);
Expand Down
3 changes: 2 additions & 1 deletion app/code/Magento/Checkout/Model/Cart/ImageProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ class ImageProvider

/**
* @var \Magento\Checkout\CustomerData\ItemPoolInterface
* @deprecated
* @deprecated No need for the pool as images are resolved in the default item implementation
* @see \Magento\Checkout\CustomerData\DefaultItem::getProductForThumbnail
*/
protected $itemPool;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,16 +86,16 @@ protected function _initProduct()
Product::class,
['getName', '__wakeup', 'getIdentities']
);
$product->expects($this->any())->method('getName')->will($this->returnValue('Parent Product'));
$product->expects($this->any())->method('getName')->willReturn('Parent Product');

/** @var Item|\PHPUnit_Framework_MockObject_MockObject $item */
$item = $this->createMock(\Magento\Quote\Model\Quote\Item::class);
$item->expects($this->any())->method('getProduct')->will($this->returnValue($product));
$item->expects($this->any())->method('getProduct')->willReturn($product);

$this->itemResolver->expects($this->any())
->method('getFinalProduct')
->with($item)
->will($this->returnValue($product));
->willReturn($product);

$this->renderer->setItem($item);
return $product;
Expand All @@ -107,7 +107,7 @@ public function testGetIdentities()
$identities = [1 => 1, 2 => 2, 3 => 3];
$product->expects($this->exactly(2))
->method('getIdentities')
->will($this->returnValue($identities));
->willReturn($identities);

$this->assertEquals($product->getIdentities(), $this->renderer->getIdentities());
}
Expand Down Expand Up @@ -135,7 +135,7 @@ public function testGetProductPriceHtml()
$this->layout->expects($this->atLeastOnce())
->method('getBlock')
->with('product.price.render.default')
->will($this->returnValue($priceRender));
->willReturn($priceRender);

$priceRender->expects($this->once())
->method('render')
Expand All @@ -147,7 +147,7 @@ public function testGetProductPriceHtml()
'display_minimal_price' => true,
'zone' => \Magento\Framework\Pricing\Render::ZONE_ITEM_LIST
]
)->will($this->returnValue($priceHtml));
)->willReturn($priceHtml);

$this->assertEquals($priceHtml, $this->renderer->getProductPriceHtml($product));
}
Expand Down

0 comments on commit 525308c

Please sign in to comment.