testMonthlyChargesQuantityIsNotSummarized()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 24
Code Lines 18

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 18
c 1
b 0
f 0
dl 0
loc 24
rs 9.6666
cc 1
nc 1
nop 0
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());
0 ignored issues
show
Unused Code introduced by
The call to hiqdev\php\billing\tools\Aggregator::__construct() has too many arguments starting with new hiqdev\billing\hiapi\type\TypeSemantics(). ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

23
        $this->aggregator = /** @scrutinizer ignore-call */ new Aggregator(new Generalizer(new TypeSemantics()), new TypeSemantics());

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.

Loading history...
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);
0 ignored issues
show
Unused Code introduced by
The assignment to $charges is dead and can be removed.
Loading history...
50
51
        // TODO: aggregate bills from charges
52
        // TODO: Check bill quantity is not summarized
53
    }
54
}
55