Total Complexity | 9 |
Total Lines | 55 |
Duplicated Lines | 0 % |
Coverage | 25% |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
8 | class OrderFixture |
||
9 | { |
||
10 | /** |
||
11 | * @var Order |
||
12 | */ |
||
13 | private $order; |
||
14 | |||
15 | 3 | public function __construct(Order $order) |
|
18 | 3 | } |
|
19 | |||
20 | 2 | public function getId(): int |
|
23 | } |
||
24 | |||
25 | public function getCustomerId(): int |
||
26 | { |
||
27 | return (int) $this->order->getCustomerId(); |
||
28 | } |
||
29 | |||
30 | public function getCustomerEmail(): string |
||
31 | { |
||
32 | return (string) $this->order->getCustomerEmail(); |
||
33 | } |
||
34 | |||
35 | /** |
||
36 | * Obtain `qty_ordered` per order item, indexed with `item_id`. |
||
37 | * |
||
38 | * @return float[] |
||
39 | */ |
||
40 | public function getOrderItemQtys(): array |
||
41 | { |
||
42 | $qtys = []; |
||
43 | foreach ($this->order->getItems() as $item) { |
||
44 | $qtys[$item->getItemId()] = $item->getQtyOrdered(); |
||
45 | } |
||
46 | |||
47 | return $qtys; |
||
48 | } |
||
49 | |||
50 | public function getPaymentMethod(): string |
||
51 | { |
||
52 | return $this->order->getPayment()->getMethod(); |
||
53 | } |
||
54 | |||
55 | public function getShippingMethod(): string |
||
56 | { |
||
57 | return $this->order->getShippingMethod(); |
||
|
|||
58 | } |
||
59 | |||
60 | public function rollback(): void |
||
63 | } |
||
64 | } |
||
65 |