diff --git a/app/code/Magento/CatalogRule/Pricing/Price/CatalogRulePrice.php b/app/code/Magento/CatalogRule/Pricing/Price/CatalogRulePrice.php index 917cb37d9e180..43f3ec4631709 100644 --- a/app/code/Magento/CatalogRule/Pricing/Price/CatalogRulePrice.php +++ b/app/code/Magento/CatalogRule/Pricing/Price/CatalogRulePrice.php @@ -99,9 +99,9 @@ public function getValue() $this->product->getId() ); $this->value = $this->value ? floatval($this->value) : false; - if ($this->value) { - $this->value = $this->priceCurrency->convertAndRound($this->value); - } + } + if ($this->value) { + $this->value = $this->priceCurrency->convertAndRound($this->value); } } diff --git a/app/code/Magento/CatalogRule/Test/Unit/Pricing/Price/CatalogRulePriceTest.php b/app/code/Magento/CatalogRule/Test/Unit/Pricing/Price/CatalogRulePriceTest.php index d3e72c37543c6..e17380c3f272b 100644 --- a/app/code/Magento/CatalogRule/Test/Unit/Pricing/Price/CatalogRulePriceTest.php +++ b/app/code/Magento/CatalogRule/Test/Unit/Pricing/Price/CatalogRulePriceTest.php @@ -208,12 +208,20 @@ public function testGetValue() public function testGetValueFromData() { + $catalogRulePrice = 7.1; + $convertedPrice = 5.84; + + $this->priceCurrencyMock->expects($this->any()) + ->method('convertAndRound') + ->with($catalogRulePrice) + ->will($this->returnValue($convertedPrice)); + $this->saleableItemMock->expects($this->once())->method('hasData') ->with('catalog_rule_price')->willReturn(true); $this->saleableItemMock->expects($this->once())->method('getData') - ->with('catalog_rule_price')->willReturn('7.1'); + ->with('catalog_rule_price')->willReturn($catalogRulePrice); - $this->assertEquals(7.1, $this->object->getValue()); + $this->assertEquals($convertedPrice, $this->object->getValue()); } public function testGetAmountNoBaseAmount()