Skip to content

Commit 2096db1

Browse files
committed
MAGETWO-75453: [Backport] - Decimal to Float Convertion #9266 - for 2.2
- cover changes with test
1 parent bc54939 commit 2096db1

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

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

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -390,4 +390,38 @@ public function dataProviderGetSavePercent()
390390
['basePrice' => '20.80', 'tierPrice' => '18.72', 'savedPercent' => '10']
391391
];
392392
}
393+
394+
/**
395+
* @param null|string|float $quantity
396+
* @param float $expectedValue
397+
* @dataProvider getQuantityDataProvider
398+
*/
399+
public function testGetQuantity($quantity, $expectedValue)
400+
{
401+
$tierPrice = new TierPrice(
402+
$this->product,
403+
$quantity,
404+
$this->calculator,
405+
$this->priceCurrencyMock,
406+
$this->session,
407+
$this->groupManagement,
408+
$this->customerGroupRetriever
409+
);
410+
411+
$this->assertEquals($expectedValue, $tierPrice->getQuantity());
412+
}
413+
414+
public function getQuantityDataProvider()
415+
{
416+
return [
417+
[null, 1],
418+
['one', 1],
419+
['', 1],
420+
[4, 4],
421+
[4.5, 4.5],
422+
['0.7', 0.7],
423+
['0.0000000', 1]
424+
];
425+
426+
}
393427
}

0 commit comments

Comments
 (0)