@@ -180,19 +180,28 @@ public function providerForGetterTierPriceList()
180
180
/**
181
181
* @dataProvider providerForTestGetSavePercent
182
182
*/
183
- public function testGetSavePercent ($ baseAmount , $ savePercent )
183
+ public function testGetSavePercent ($ baseAmount , $ tierPrice , $ savePercent )
184
184
{
185
- $ basePrice = 10. ;
185
+ /** @var \Magento\Framework\Pricing\Amount\AmountInterface|\PHPUnit_Framework_MockObject_MockObject $amount */
186
186
$ amount = $ this ->getMockForAbstractClass (\Magento \Framework \Pricing \Amount \AmountInterface::class);
187
- $ amount ->expects ($ this ->once ())->method ('getBaseAmount ' )->willReturn ($ baseAmount );
187
+ $ amount ->expects ($ this ->any ())
188
+ ->method ('getValue ' )
189
+ ->will ($ this ->returnValue ($ tierPrice ));
190
+
191
+ $ priceAmount = $ this ->getMockForAbstractClass (\Magento \Framework \Pricing \Amount \AmountInterface::class);
192
+ $ priceAmount ->expects ($ this ->any ())
193
+ ->method ('getValue ' )
194
+ ->will ($ this ->returnValue ($ baseAmount ));
195
+
188
196
$ price = $ this ->createMock (\Magento \Framework \Pricing \Price \PriceInterface::class);
189
197
$ price ->expects ($ this ->any ())
190
- ->method ('getValue ' )
191
- ->will ($ this ->returnValue ($ basePrice ));
198
+ ->method ('getAmount ' )
199
+ ->will ($ this ->returnValue ($ priceAmount ));
192
200
193
201
$ this ->priceInfo ->expects ($ this ->any ())
194
202
->method ('getPrice ' )
195
203
->will ($ this ->returnValue ($ price ));
204
+
196
205
$ this ->assertEquals ($ savePercent , $ this ->model ->getSavePercent ($ amount ));
197
206
}
198
207
@@ -202,8 +211,8 @@ public function testGetSavePercent($baseAmount, $savePercent)
202
211
public function providerForTestGetSavePercent ()
203
212
{
204
213
return [
205
- 'no fraction ' => [9.0000 , 10 ],
206
- 'lower half ' => [9.1234 , 9 ],
214
+ 'no fraction ' => [9.0000 , 8.1 , 10 ],
215
+ 'lower half ' => [9.1234 , 8.3 , 9 ],
207
216
];
208
217
}
209
218
}
0 commit comments