Passed
Push — master ( b0573e...b2a2f5 )
by Olha
05:18
created

MultiFactorAuthRestApiFixtures   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 93
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 6
eloc 23
dl 0
loc 93
rs 10
c 1
b 0
f 0

6 Methods

Rating   Name   Duplication   Size   Complexity  
A generateCartUrl() 0 3 1
A generateUrl() 0 3 1
A createCartRequestPayload() 0 10 1
A buildFixtures() 0 5 1
A getCustomerTransfer() 0 3 1
A createRequestPayload() 0 7 1
1
<?php
2
3
/**
4
 * This file is part of the Spryker Commerce OS.
5
 * For full license information, please view the LICENSE file that was distributed with this source code.
6
 */
7
8
declare(strict_types = 1);
9
10
namespace PyzTest\Glue\MultiFactorAuth\RestApi\Fixtures;
11
12
use Generated\Shared\Transfer\CustomerTransfer;
13
use PyzTest\Glue\MultiFactorAuth\MultiFactorAuthRestApiTester;
14
use SprykerTest\Shared\Testify\Fixtures\FixturesBuilderInterface;
15
use SprykerTest\Shared\Testify\Fixtures\FixturesContainerInterface;
16
17
class MultiFactorAuthRestApiFixtures implements FixturesBuilderInterface, FixturesContainerInterface
18
{
19
    /**
20
     * @var string
21
     */
22
    protected const TEST_USERNAME = 'MultiFactorAuthRestApiFixtures';
23
24
    /**
25
     * @var string
26
     */
27
    protected const MFA_TYPE = 'email';
28
29
    /**
30
     * @var string
31
     */
32
    protected const RESOURCE_CARTS = 'carts';
33
34
    /**
35
     * @var \Generated\Shared\Transfer\CustomerTransfer
36
     */
37
    protected CustomerTransfer $customerTransfer;
38
39
    /**
40
     * @param \PyzTest\Glue\MultiFactorAuth\MultiFactorAuthRestApiTester $I
41
     *
42
     * @return \SprykerTest\Shared\Testify\Fixtures\FixturesContainerInterface
43
     */
44
    public function buildFixtures(MultiFactorAuthRestApiTester $I): FixturesContainerInterface
45
    {
46
        $this->customerTransfer = $I->createCustomer(static::TEST_USERNAME);
47
48
        return $this;
49
    }
50
51
    /**
52
     * @return \Generated\Shared\Transfer\CustomerTransfer
53
     */
54
    public function getCustomerTransfer(): CustomerTransfer
55
    {
56
        return $this->customerTransfer;
57
    }
58
59
    /**
60
     * @param string $resourceType
61
     *
62
     * @return array<string, mixed>
63
     */
64
    public function createRequestPayload(string $resourceType): array
65
    {
66
        return [
67
            'data' => [
68
                'type' => $resourceType,
69
                'attributes' => [
70
                    'type' => static::MFA_TYPE,
71
                ],
72
            ],
73
        ];
74
    }
75
76
    /**
77
     * @return array<string, mixed>
78
     */
79
    public function createCartRequestPayload(): array
80
    {
81
        return [
82
            'data' => [
83
                'type' => static::RESOURCE_CARTS,
84
                'attributes' => [
85
                    'name' => 'Test Cart',
86
                    'priceMode' => 'GROSS_MODE',
87
                    'currency' => 'EUR',
88
                    'store' => 'DE',
89
                ],
90
            ],
91
        ];
92
    }
93
94
    /**
95
     * @param string $resourceName
96
     *
97
     * @return string
98
     */
99
    public function generateUrl(string $resourceName): string
100
    {
101
        return sprintf('/%s', $resourceName);
102
    }
103
104
    /**
105
     * @return string
106
     */
107
    public function generateCartUrl(): string
108
    {
109
        return sprintf('/%s', static::RESOURCE_CARTS);
110
    }
111
}
112