Passed
Push — master ( 185b2c...24e5ac )
by Olha
08:12
created

MultiFactorAuthStorefrontApiFixtures   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 62
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 4
eloc 13
dl 0
loc 62
rs 10
c 1
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A buildFixtures() 0 5 1
A generateUrl() 0 3 1
A createRequestPayload() 0 7 1
A getCustomerTransfer() 0 3 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\StorefrontApi\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\MultiFactorAuthStorefrontApiTester;
14
use SprykerTest\Shared\Testify\Fixtures\FixturesBuilderInterface;
15
use SprykerTest\Shared\Testify\Fixtures\FixturesContainerInterface;
16
17
class MultiFactorAuthStorefrontApiFixtures implements FixturesBuilderInterface, FixturesContainerInterface
18
{
19
    /**
20
     * @var string
21
     */
22
    protected const TEST_CUSTOMER_NAME = '[email protected]';
23
24
    /**
25
     * @var string
26
     */
27
    protected const MFA_TYPE = 'email';
28
29
    /**
30
     * @var \Generated\Shared\Transfer\CustomerTransfer
31
     */
32
    protected CustomerTransfer $customerTransfer;
33
34
    /**
35
     * @param \PyzTest\Glue\MultiFactorAuth\MultiFactorAuthStorefrontApiTester $I
36
     *
37
     * @return \SprykerTest\Shared\Testify\Fixtures\FixturesContainerInterface
38
     */
39
    public function buildFixtures(MultiFactorAuthStorefrontApiTester $I): FixturesContainerInterface
40
    {
41
        $this->customerTransfer = $I->createCustomer(static::TEST_CUSTOMER_NAME);
42
43
        return $this;
44
    }
45
46
    /**
47
     * @return \Generated\Shared\Transfer\CustomerTransfer
48
     */
49
    public function getCustomerTransfer(): CustomerTransfer
50
    {
51
        return $this->customerTransfer;
52
    }
53
54
    /**
55
     * @param string $resourceType
56
     *
57
     * @return array<string, mixed>
58
     */
59
    public function createRequestPayload(string $resourceType): array
60
    {
61
        return [
62
            'data' => [
63
                'type' => $resourceType,
64
                'attributes' => [
65
                    'type' => static::MFA_TYPE,
66
                ],
67
            ],
68
        ];
69
    }
70
71
    /**
72
     * @param string $resourceName
73
     *
74
     * @return string
75
     */
76
    public function generateUrl(string $resourceName): string
77
    {
78
        return sprintf('/%s', $resourceName);
79
    }
80
}
81