Skip to content

Commit dfd6739

Browse files
committed
MAGETWO-63698: [Backport] - Fixed bundle product has wrong price in wishlist - for 2.1
1 parent 7d40742 commit dfd6739

File tree

2 files changed

+14
-25
lines changed

2 files changed

+14
-25
lines changed

app/code/Magento/Bundle/Test/Unit/Pricing/Price/BundleSelectionPriceTest.php

Lines changed: 13 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -77,52 +77,52 @@ class BundleSelectionPriceTest extends \PHPUnit_Framework_TestCase
7777
protected function setUp()
7878
{
7979
$this->productMock = $this->getMock(
80-
'Magento\Catalog\Model\Product',
80+
\Magento\Catalog\Model\Product::class,
8181
['__wakeup', 'getPriceInfo', 'getSelectionPriceType', 'getSelectionPriceValue'],
8282
[],
8383
'',
8484
false
8585
);
8686

8787
$this->bundleMock = $this->getMock(
88-
'Magento\Catalog\Model\Product',
88+
\Magento\Catalog\Model\Product::class,
8989
['__wakeup', 'getPriceType', 'getPriceInfo', 'setFinalPrice', 'getData'],
9090
[],
9191
'',
9292
false
9393
);
94-
$this->calculatorMock = $this->getMockBuilder('Magento\Framework\Pricing\Adjustment\CalculatorInterface')
94+
$this->calculatorMock = $this->getMockBuilder(\Magento\Framework\Pricing\Adjustment\CalculatorInterface::class)
9595
->getMockForAbstractClass();
9696
$this->eventManagerMock = $this->getMock(
97-
'Magento\Framework\Event\Manager',
97+
\Magento\Framework\Event\Manager::class,
9898
['dispatch'],
9999
[],
100100
'',
101101
false
102102
);
103103
$this->priceInfoMock = $this->getMock(
104-
'Magento\Framework\Pricing\PriceInfo\Base',
104+
\Magento\Framework\Pricing\PriceInfo\Base::class,
105105
['getPrice'],
106106
[],
107107
'',
108108
false
109109
);
110110
$this->discountCalculatorMock = $this->getMock(
111-
'Magento\Bundle\Pricing\Price\DiscountCalculator',
111+
\Magento\Bundle\Pricing\Price\DiscountCalculator::class,
112112
[],
113113
[],
114114
'',
115115
false
116116
);
117117
$this->finalPriceMock = $this->getMock(
118-
'Magento\Catalog\Pricing\Price\FinalPrice',
118+
\Magento\Catalog\Pricing\Price\FinalPrice::class,
119119
[],
120120
[],
121121
'',
122122
false
123123
);
124124
$this->regularPriceMock = $this->getMock(
125-
'Magento\Catalog\Pricing\Price\RegularPrice',
125+
\Magento\Catalog\Pricing\Price\RegularPrice::class,
126126
[],
127127
[],
128128
'',
@@ -132,18 +132,18 @@ protected function setUp()
132132
->method('getPriceInfo')
133133
->will($this->returnValue($this->priceInfoMock));
134134

135-
$this->priceCurrencyMock = $this->getMock('\Magento\Framework\Pricing\PriceCurrencyInterface');
135+
$this->priceCurrencyMock = $this->getMock(\Magento\Framework\Pricing\PriceCurrencyInterface::class);
136136

137137
$this->quantity = 1;
138138

139139
$this->setupSelectionPrice();
140140
}
141141

142-
protected function setupSelectionPrice($useRegularPrice = false)
142+
protected function setupSelectionPrice($useRegularPrice = false, $qty = 1)
143143
{
144144
$this->selectionPrice = new \Magento\Bundle\Pricing\Price\BundleSelectionPrice(
145145
$this->productMock,
146-
$this->quantity,
146+
$qty,
147147
$this->calculatorMock,
148148
$this->priceCurrencyMock,
149149
$this->bundleMock,
@@ -325,18 +325,7 @@ public function testFixedPriceWithMultipleQty($useRegularPrice)
325325
{
326326
$qty = 2;
327327

328-
$selectionPrice = new \Magento\Bundle\Pricing\Price\BundleSelectionPrice(
329-
$this->productMock,
330-
$qty,
331-
$this->calculatorMock,
332-
$this->priceCurrencyMock,
333-
$this->bundleMock,
334-
$this->eventManagerMock,
335-
$this->discountCalculatorMock,
336-
$useRegularPrice
337-
);
338-
339-
$this->setupSelectionPrice($useRegularPrice);
328+
$this->setupSelectionPrice($useRegularPrice, $qty);
340329
$regularPrice = 100.125;
341330
$discountedPrice = 70.453;
342331
$convertedValue = 100.247;
@@ -373,7 +362,7 @@ public function testFixedPriceWithMultipleQty($useRegularPrice)
373362
->with($actualPrice)
374363
->will($this->returnValue($expectedPrice));
375364

376-
$this->assertEquals($expectedPrice, $selectionPrice->getValue());
365+
$this->assertEquals($expectedPrice, $this->selectionPrice->getValue());
377366
}
378367

379368
public function useRegularPriceDataProvider()

app/code/Magento/Wishlist/Model/ResourceModel/Item/Collection.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,7 @@ protected function _assignProducts()
291291
'thumbnail',
292292
'links_purchased_separately',
293293
'links_title',
294-
'price_type'
294+
'price_type',
295295
];
296296

297297
$productCollection->addPriceData()

0 commit comments

Comments
 (0)