createRequestPayload()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
eloc 5
c 2
b 0
f 0
dl 0
loc 7
rs 10
cc 1
nc 1
nop 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;
0 ignored issues
show
Bug introduced by
The type Generated\Shared\Transfer\CustomerTransfer was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
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
    protected const TEST_USERNAME = 'MultiFactorAuthRestApiFixtures';
20
21
    protected const MFA_TYPE = 'email';
22
23
    protected const RESOURCE_CARTS = 'carts';
24
25
    protected CustomerTransfer $customerTransfer;
26
27
    public function buildFixtures(MultiFactorAuthRestApiTester $I): FixturesContainerInterface
28
    {
29
        $this->customerTransfer = $I->createCustomer(static::TEST_USERNAME);
30
31
        return $this;
32
    }
33
34
    public function getCustomerTransfer(): CustomerTransfer
35
    {
36
        return $this->customerTransfer;
37
    }
38
39
    /**
40
     * @param string $resourceType
41
     *
42
     * @return array<string, mixed>
43
     */
44
    public function createRequestPayload(string $resourceType): array
45
    {
46
        return [
47
            'data' => [
48
                'type' => $resourceType,
49
                'attributes' => [
50
                    'type' => static::MFA_TYPE,
51
                ],
52
            ],
53
        ];
54
    }
55
56
    /**
57
     * @return array<string, mixed>
58
     */
59
    public function createCartRequestPayload(): array
60
    {
61
        return [
62
            'data' => [
63
                'type' => static::RESOURCE_CARTS,
64
                'attributes' => [
65
                    'name' => 'Test Cart',
66
                    'priceMode' => 'GROSS_MODE',
67
                    'currency' => 'EUR',
68
                    'store' => 'DE',
69
                ],
70
            ],
71
        ];
72
    }
73
74
    public function generateUrl(string $resourceName): string
75
    {
76
        return sprintf('/%s', $resourceName);
77
    }
78
79
    public function generateCartUrl(): string
80
    {
81
        return sprintf('/%s', static::RESOURCE_CARTS);
82
    }
83
}
84