Skip to content

Commit b8a622b

Browse files
committed
Fix test
1 parent a4a4ebe commit b8a622b

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed

tests/unit/price/ProgressivePriceTest.php

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,4 +215,41 @@ private function progressivePriceProvider(): Generator
215215
],
216216
];
217217
}
218+
219+
/**
220+
* @dataProvider progressivePriceProviderSmallUsage
221+
*/
222+
public function testProgressivePriceSmallUsage(
223+
array $inputThresholdsArray,
224+
int $expectedAmount,
225+
string $startPrice,
226+
string $prepaid = '0'
227+
): void {
228+
$price = $this->createProgressivePrice(
229+
prepaid: $prepaid,
230+
startPrice: $startPrice,
231+
thresholdsArray: $inputThresholdsArray
232+
);
233+
$this->usage = Quantity::bps(6043);
234+
$usage = $price->calculateUsage($this->usage);
235+
$this->assertSame($this->usage->getQuantity(), $usage->getQuantity());
236+
237+
$amount = $price->calculateSum($this->usage);
238+
$this->assertEquals($expectedAmount, $amount->getAmount());
239+
}
240+
241+
private function progressivePriceProviderSmallUsage(): Generator
242+
{
243+
yield 'Simple case' => [
244+
'thresholds' => [
245+
['price' => '10', 'currency' => 'EUR', 'quantity' => '0', 'unit' => 'gbps'],
246+
],
247+
'money' => 0,
248+
'price' => '1',
249+
'prepaid' => '0',
250+
'trace' => [
251+
'6043bps * 0.00000001 = 0.00',
252+
],
253+
];
254+
}
218255
}

0 commit comments

Comments
 (0)