File tree Expand file tree Collapse file tree 2 files changed +15
-1
lines changed
app/code/Magento/CatalogRule Expand file tree Collapse file tree 2 files changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -85,7 +85,8 @@ public function getValue()
85
85
{
86
86
if (null === $ this ->value ) {
87
87
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 ;
89
90
} else {
90
91
$ this ->value = $ this ->ruleResource ->getRulePrice (
91
92
$ this ->dateTime ->scopeDate ($ this ->storeManager ->getStore ()->getId ()),
Original file line number Diff line number Diff line change @@ -176,4 +176,17 @@ public function testGetAmountNoBaseAmount()
176
176
$ result = $ this ->object ->getValue ();
177
177
$ this ->assertFalse ($ result );
178
178
}
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
+ }
179
192
}
You can’t perform that action at this time.
0 commit comments