| @@ 80-92 (lines=13) @@ | ||
| 77 | $this->assertCharges($rel, $this->value); |
|
| 78 | } |
|
| 79 | ||
| 80 | public function assertCharges($fd, $sum) |
|
| 81 | { |
|
| 82 | $action = $this->createAction($this->prepaid->multiply(2)); |
|
| 83 | $charge = $action->calculateCharge($this->price); |
|
| 84 | $charges = $fd->modifyCharge($charge, $action); |
|
| 85 | $this->assertInternalType('array', $charges); |
|
| 86 | $this->assertSame(2, count($charges)); |
|
| 87 | $this->assertSame($charge, $charges[0]); |
|
| 88 | $discount = $charges[1]; |
|
| 89 | $this->assertInstanceOf(Charge::class, $discount); |
|
| 90 | $this->assertEquals(Quantity::items(1), $discount->getUsage()); |
|
| 91 | $this->assertEquals($sum, $discount->getSum()); |
|
| 92 | } |
|
| 93 | } |
|
| 94 | ||
| @@ 30-42 (lines=13) @@ | ||
| 27 | return (new GrowingDiscount($value))->since($month)->everyMonth(); |
|
| 28 | } |
|
| 29 | ||
| 30 | public function assertCharges($fd, $sum) |
|
| 31 | { |
|
| 32 | $action = $this->createAction($this->prepaid->multiply(2)); |
|
| 33 | $charge = $action->calculateCharge($this->price); |
|
| 34 | $charges = $fd->modifyCharge($charge, $action); |
|
| 35 | $this->assertInternalType('array', $charges); |
|
| 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, $discount->getSum()); |
|
| 42 | } |
|
| 43 | } |
|
| 44 | ||