Skip to content

Commit 78a7e3e

Browse files
committed
Merge remote-tracking branch 'mpi/MC-22632' into Chaika-PR-2019-11-19
2 parents 3491d79 + acd7850 commit 78a7e3e

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

app/code/Magento/CatalogRule/Pricing/Price/CatalogRulePrice.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,8 @@ public function getValue()
8585
{
8686
if (null === $this->value) {
8787
if ($this->product->hasData(self::PRICE_CODE)) {
88-
$this->value = (float)$this->product->getData(self::PRICE_CODE) ?: false;
88+
$value = $this->product->getData(self::PRICE_CODE);
89+
$this->value = $value ? (float)$value : false;
8990
} else {
9091
$this->value = $this->ruleResource->getRulePrice(
9192
$this->dateTime->scopeDate($this->storeManager->getStore()->getId()),

app/code/Magento/CatalogRule/Test/Unit/Pricing/Price/CatalogRulePriceTest.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,4 +176,17 @@ public function testGetAmountNoBaseAmount()
176176
$result = $this->object->getValue();
177177
$this->assertFalse($result);
178178
}
179+
180+
public function testGetValueWithNullAmount()
181+
{
182+
$catalogRulePrice = null;
183+
$convertedPrice = 0.0;
184+
185+
$this->saleableItemMock->expects($this->once())->method('hasData')
186+
->with('catalog_rule_price')->willReturn(true);
187+
$this->saleableItemMock->expects($this->once())->method('getData')
188+
->with('catalog_rule_price')->willReturn($catalogRulePrice);
189+
190+
$this->assertEquals($convertedPrice, $this->object->getValue());
191+
}
179192
}

0 commit comments

Comments
 (0)