Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
57.14% covered (warning)
57.14%
4 / 7
75.00% covered (warning)
75.00%
3 / 4
CRAP
0.00% covered (danger)
0.00%
0 / 1
Order
57.14% covered (warning)
57.14%
4 / 7
75.00% covered (warning)
75.00%
3 / 4
5.26
0.00% covered (danger)
0.00%
0 / 1
 __construct
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
1 / 1
1
 getId
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 getOrderLineList
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 addOrderLine
0.00% covered (danger)
0.00%
0 / 3
0.00% covered (danger)
0.00%
0 / 1
2
1<?php
2
3namespace Apie\IntegrationTests\Apie\TypeDemo\Resources;
4
5use Apie\Core\Attributes\Description;
6use Apie\Core\Attributes\FakeCount;
7use Apie\Core\Attributes\RemovalCheck;
8use Apie\Core\Attributes\StaticCheck;
9use Apie\Core\Entities\EntityInterface;
10use Apie\IntegrationTests\Apie\TypeDemo\Entities\OrderLine;
11use Apie\IntegrationTests\Apie\TypeDemo\Enums\OrderStatus;
12use Apie\IntegrationTests\Apie\TypeDemo\Identifiers\OrderIdentifier;
13use Apie\IntegrationTests\Apie\TypeDemo\Lists\OrderLineList;
14
15#[RemovalCheck(new StaticCheck())]
16#[FakeCount(1)]
17#[Description('An order is a web order and consists of multiple order lines')]
18class Order implements EntityInterface
19{
20    private OrderIdentifier $id;
21
22    private OrderStatus $orderStatus;
23
24    public function __construct(private OrderLineList $orderLineList)
25    {
26        $this->id = new OrderIdentifier(null);
27        $this->orderStatus = OrderStatus::DRAFT;
28    }
29
30    public function getId(): OrderIdentifier
31    {
32        return $this->id;
33    }
34
35    public function getOrderLineList(): OrderLineList
36    {
37        return $this->orderLineList;
38    }
39
40    public function addOrderLine(OrderLine $orderLine): Order
41    {
42        $this->orderStatus->ensureDraft();
43        $this->orderLineList[] = $orderLine;
44
45        return $this;
46    }
47}