1 | <?php |
||
2 | /** |
||
3 | * PHP Billing Library |
||
4 | * |
||
5 | * @link https://github.com/hiqdev/php-billing |
||
6 | * @package php-billing |
||
7 | * @license BSD-3-Clause |
||
8 | * @copyright Copyright (c) 2017-2018, HiQDev (http://hiqdev.com/) |
||
9 | */ |
||
10 | |||
11 | namespace hiqdev\php\billing\tests\unit\charge\modifiers; |
||
12 | |||
13 | use DateTimeImmutable; |
||
14 | use hiqdev\php\billing\charge\Charge; |
||
15 | use hiqdev\php\billing\charge\modifiers\GrowingDiscount; |
||
16 | use hiqdev\php\units\Quantity; |
||
17 | |||
18 | /** |
||
19 | * @author Andrii Vasyliev <[email protected]> |
||
20 | */ |
||
21 | class GrowingDiscountTest extends FixedDiscountTest |
||
22 | { |
||
23 | protected function buildDiscount($value) |
||
24 | { |
||
25 | $month = (new DateTimeImmutable())->modify('first day of this month midnight'); |
||
26 | |||
27 | return (new GrowingDiscount($value))->since($month)->every('month')->till('3000-01'); |
||
28 | } |
||
29 | |||
30 | public function assertCharges($fd, $sum) |
||
31 | { |
||
32 | $action = $this->createAction($this->prepaid->multiply(2)); |
||
33 | $charge = $this->calculator->calculateCharge($this->price, $action); |
||
34 | $charges = $fd->modifyCharge($charge, $action); |
||
35 | $this->assertInternalType('array', $charges); |
||
0 ignored issues
–
show
|
|||
36 | $this->assertSame(2, count($charges)); |
||
37 | $this->assertSame($charge, $charges[0]); |
||
38 | $discount = $charges[1]; |
||
39 | $this->assertInstanceOf(Charge::class, $discount); |
||
40 | $this->assertEquals(Quantity::items(1), $discount->getUsage()); |
||
41 | $this->assertEquals($sum->multiply(-1), $discount->getSum()); |
||
42 | } |
||
43 | } |
||
44 |
This function has been deprecated. The supplier of the function has supplied an explanatory message.
The explanatory message should give you some clue as to whether and when the function will be removed and what other function to use instead.