Skip to content

Commit 500728a

Browse files
committed
MAGETWO-70377: [GitHub] Tier price saving percentage wrong when VAT is included in price #8833
1 parent 499e951 commit 500728a

File tree

1 file changed

+16
-7
lines changed

1 file changed

+16
-7
lines changed

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

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -180,19 +180,28 @@ public function providerForGetterTierPriceList()
180180
/**
181181
* @dataProvider providerForTestGetSavePercent
182182
*/
183-
public function testGetSavePercent($baseAmount, $savePercent)
183+
public function testGetSavePercent($baseAmount, $tierPrice, $savePercent)
184184
{
185-
$basePrice = 10.;
185+
/** @var \Magento\Framework\Pricing\Amount\AmountInterface|\PHPUnit_Framework_MockObject_MockObject $amount */
186186
$amount = $this->getMockForAbstractClass(\Magento\Framework\Pricing\Amount\AmountInterface::class);
187-
$amount->expects($this->once())->method('getBaseAmount')->willReturn($baseAmount);
187+
$amount->expects($this->any())
188+
->method('getValue')
189+
->will($this->returnValue($tierPrice));
190+
191+
$priceAmount = $this->getMockForAbstractClass(\Magento\Framework\Pricing\Amount\AmountInterface::class);
192+
$priceAmount->expects($this->any())
193+
->method('getValue')
194+
->will($this->returnValue($baseAmount));
195+
188196
$price = $this->createMock(\Magento\Framework\Pricing\Price\PriceInterface::class);
189197
$price->expects($this->any())
190-
->method('getValue')
191-
->will($this->returnValue($basePrice));
198+
->method('getAmount')
199+
->will($this->returnValue($priceAmount));
192200

193201
$this->priceInfo->expects($this->any())
194202
->method('getPrice')
195203
->will($this->returnValue($price));
204+
196205
$this->assertEquals($savePercent, $this->model->getSavePercent($amount));
197206
}
198207

@@ -202,8 +211,8 @@ public function testGetSavePercent($baseAmount, $savePercent)
202211
public function providerForTestGetSavePercent()
203212
{
204213
return [
205-
'no fraction' => [9.0000, 10],
206-
'lower half' => [9.1234, 9],
214+
'no fraction' => [9.0000, 8.1, 10],
215+
'lower half' => [9.1234, 8.3, 9],
207216
];
208217
}
209218
}

0 commit comments

Comments
 (0)