Skip to content

Commit b7c637f

Browse files
committed
MAGETWO-50605: Tier pricing is not validated against product special price
1 parent 0fe06aa commit b7c637f

File tree

2 files changed

+14
-22
lines changed

2 files changed

+14
-22
lines changed

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

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -162,14 +162,8 @@ public function providerForGetterTierPriceList()
162162
'basePrice' => 20.,
163163
'expectedResult' => [
164164
[
165-
'price' => '50.',
166-
'website_price' => '50.',
167-
'price_qty' => '2.',
168-
'cust_group' => Group::CUST_GROUP_ALL,
169-
],
170-
[
171-
'price' => '30.',
172-
'website_price' => '30.',
165+
'price' => '15.',
166+
'website_price' => '15.',
173167
'price_qty' => '5.',
174168
'cust_group' => Group::CUST_GROUP_ALL
175169
],

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

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,8 @@
88

99
namespace Magento\Catalog\Test\Unit\Pricing\Price;
1010

11-
use \Magento\Catalog\Pricing\Price\TierPrice;
12-
use \Magento\Catalog\Pricing\Price\RegularPrice;
13-
11+
use Magento\Catalog\Pricing\Price\TierPrice;
12+
use Magento\Catalog\Pricing\Price\FinalPrice;
1413
use Magento\Customer\Model\Group;
1514
use Magento\Customer\Model\GroupManagement;
1615

@@ -271,6 +270,10 @@ public function testGetterTierPriceList($tierPrices, $basePrice, $expectedResult
271270
$this->calculator->expects($this->atLeastOnce())->method('getAmount')
272271
->will($this->returnArgument(0));
273272

273+
$this->priceInfo->expects(static::atLeastOnce())
274+
->method('getPrice')
275+
->with(FinalPrice::PRICE_CODE)
276+
->willReturn($price);
274277
$this->priceCurrencyMock->expects($this->any())
275278
->method('convertAndRound')
276279
->will($this->returnCallback(
@@ -365,20 +368,15 @@ public function providerForGetterTierPriceList()
365368
*/
366369
public function testGetSavePercent($basePrice, $tierPrice, $savedPercent)
367370
{
368-
$priceAmount = $this->getMockForAbstractClass('Magento\Framework\Pricing\Amount\AmountInterface');
369-
$priceAmount->expects($this->once())
370-
->method('getBaseAmount')
371-
->will($this->returnValue($basePrice));
372-
373371
$price = $this->getMock('Magento\Framework\Pricing\Price\PriceInterface');
374-
$price->expects($this->any())
375-
->method('getAmount')
376-
->will($this->returnValue($priceAmount));
377372

378-
$this->priceInfo->expects($this->atLeastOnce())
373+
$this->priceInfo->expects(static::atLeastOnce())
379374
->method('getPrice')
380-
->will($this->returnValue($price))
381-
->with(RegularPrice::PRICE_CODE);
375+
->with(FinalPrice::PRICE_CODE)
376+
->willReturn($price);
377+
$price->expects(static::atLeastOnce())
378+
->method('getValue')
379+
->willReturn($basePrice);
382380

383381
$amount = $this->getMockForAbstractClass('Magento\Framework\Pricing\Amount\AmountInterface');
384382
$amount->expects($this->atLeastOnce())

0 commit comments

Comments
 (0)