|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace hiqdev\billing\hiapi\tests\unit\charge; |
|
4
|
|
|
|
|
5
|
|
|
use hiqdev\billing\hiapi\charge\Aggregator; |
|
6
|
|
|
use hiqdev\billing\hiapi\charge\Generalizer; |
|
7
|
|
|
use hiqdev\billing\hiapi\type\TypeSemantics; |
|
8
|
|
|
use hiqdev\php\billing\action\Action; |
|
9
|
|
|
use hiqdev\php\billing\order\Order; |
|
10
|
|
|
use hiqdev\php\billing\target\Target; |
|
11
|
|
|
use hiqdev\php\billing\type\Type; |
|
12
|
|
|
use hiqdev\php\units\Quantity; |
|
13
|
|
|
|
|
14
|
|
|
class AggregatorTest extends \hiqdev\php\billing\tests\unit\charge\AggregatorTest |
|
15
|
|
|
{ |
|
16
|
|
|
/** @var Aggregator */ |
|
17
|
|
|
protected $aggregator; |
|
18
|
|
|
|
|
19
|
|
|
public function setUp() |
|
20
|
|
|
{ |
|
21
|
|
|
parent::setUp(); |
|
22
|
|
|
|
|
23
|
|
|
$this->aggregator = new Aggregator(new Generalizer(new TypeSemantics()), new TypeSemantics()); |
|
24
|
|
|
} |
|
25
|
|
|
|
|
26
|
|
|
public function testMonthlyChargesQuantityIsNotSummarized() |
|
27
|
|
|
{ |
|
28
|
|
|
$this->markTestIncomplete('Test is strictly bound to certificate plan. TODO: implement for server'); |
|
29
|
|
|
$actions = [ |
|
30
|
|
|
new Action( |
|
31
|
|
|
null, |
|
32
|
|
|
new Type(null, 'monthly,monthly'), |
|
33
|
|
|
new Target(Target::ANY, 'server'), |
|
34
|
|
|
Quantity::items(0.25), |
|
35
|
|
|
$this->plan->customer, |
|
36
|
|
|
new \DateTimeImmutable() |
|
37
|
|
|
), |
|
38
|
|
|
new Action( |
|
39
|
|
|
null, |
|
40
|
|
|
new Type(null, 'monthly,monthly'), |
|
41
|
|
|
new Target(Target::ANY, 'server'), |
|
42
|
|
|
Quantity::items(1), |
|
43
|
|
|
$this->plan->customer, |
|
44
|
|
|
new \DateTimeImmutable() |
|
45
|
|
|
), |
|
46
|
|
|
]; |
|
47
|
|
|
|
|
48
|
|
|
$order = new Order(null, $this->plan->customer, $actions); |
|
49
|
|
|
$charges = $this->calculator->calculateCharges($order); |
|
|
|
|
|
|
50
|
|
|
|
|
51
|
|
|
// TODO: aggregate bills from charges |
|
52
|
|
|
// TODO: Check bill quantity is not summarized |
|
53
|
|
|
} |
|
54
|
|
|
} |
|
55
|
|
|
|