File tree 2 files changed +13
-5
lines changed
app/code/Magento/CatalogRule
2 files changed +13
-5
lines changed Original file line number Diff line number Diff line change @@ -99,9 +99,9 @@ public function getValue()
99
99
$ this ->product ->getId ()
100
100
);
101
101
$ this ->value = $ this ->value ? floatval ($ this ->value ) : false ;
102
- if ( $ this -> value ) {
103
- $ this -> value = $ this -> priceCurrency -> convertAndRound ($ this ->value );
104
- }
102
+ }
103
+ if ($ this ->value ) {
104
+ $ this -> value = $ this -> priceCurrency -> convertAndRound ( $ this -> value );
105
105
}
106
106
}
107
107
Original file line number Diff line number Diff line change @@ -208,12 +208,20 @@ public function testGetValue()
208
208
209
209
public function testGetValueFromData ()
210
210
{
211
+ $ catalogRulePrice = 7.1 ;
212
+ $ convertedPrice = 5.84 ;
213
+
214
+ $ this ->priceCurrencyMock ->expects ($ this ->any ())
215
+ ->method ('convertAndRound ' )
216
+ ->with ($ catalogRulePrice )
217
+ ->will ($ this ->returnValue ($ convertedPrice ));
218
+
211
219
$ this ->saleableItemMock ->expects ($ this ->once ())->method ('hasData ' )
212
220
->with ('catalog_rule_price ' )->willReturn (true );
213
221
$ this ->saleableItemMock ->expects ($ this ->once ())->method ('getData ' )
214
- ->with ('catalog_rule_price ' )->willReturn (' 7.1 ' );
222
+ ->with ('catalog_rule_price ' )->willReturn ($ catalogRulePrice );
215
223
216
- $ this ->assertEquals (7.1 , $ this ->object ->getValue ());
224
+ $ this ->assertEquals ($ convertedPrice , $ this ->object ->getValue ());
217
225
}
218
226
219
227
public function testGetAmountNoBaseAmount ()
You can’t perform that action at this time.
0 commit comments