1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace hiqdev\billing\hiapi\tests\unit\charge; |
4
|
|
|
|
5
|
|
|
use hiqdev\billing\hiapi\charge\Generalizer; |
6
|
|
|
use hiqdev\billing\hiapi\type\TypeSemantics; |
7
|
|
|
use hiqdev\php\billing\action\Action; |
8
|
|
|
use hiqdev\php\billing\order\Order; |
9
|
|
|
use hiqdev\php\billing\target\Target; |
10
|
|
|
use hiqdev\php\billing\type\Type; |
11
|
|
|
use hiqdev\php\billing\tools\Aggregator; |
12
|
|
|
use hiqdev\php\units\Quantity; |
13
|
|
|
|
14
|
|
|
class AggregatorTest extends \hiqdev\php\billing\tests\unit\tools\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->calculateOrder($order); |
|
|
|
|
50
|
|
|
|
51
|
|
|
// TODO: aggregate bills from charges |
52
|
|
|
// TODO: Check bill quantity is not summarized |
53
|
|
|
} |
54
|
|
|
} |
55
|
|
|
|
This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.
If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress. Please note the @ignore annotation hint above.