CustomerApiTester::assertCustomersAttributes()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 38
Code Lines 26

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 26
dl 0
loc 38
rs 9.504
c 0
b 0
f 0
cc 1
nc 1
nop 2
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\Customer;
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 Generated\Shared\Transfer\RestCustomersAttributesTransfer;
0 ignored issues
show
Bug introduced by
The type Generated\Shared\Transfe...omersAttributesTransfer 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...
14
use SprykerTest\Glue\Testify\Tester\ApiEndToEndTester;
15
16
/**
17
 * Inherited Methods
18
 *
19
 * @method void wantToTest($text)
20
 * @method void wantTo($text)
21
 * @method void execute($callable)
22
 * @method void expectTo($prediction)
23
 * @method void expect($prediction)
24
 * @method void amGoingTo($argumentation)
25
 * @method void am($role)
26
 * @method void lookForwardTo($achieveValue)
27
 * @method void comment($description)
28
 * @method void pause()
29
 *
30
 * @SuppressWarnings(\PyzTest\Glue\Customer\PHPMD)
31
 */
32
class CustomerApiTester extends ApiEndToEndTester
33
{
34
    use _generated\CustomerApiTesterActions;
0 ignored issues
show
Bug introduced by
The type PyzTest\Glue\Customer\_g...ustomerApiTesterActions 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...
35
36
    /**
37
     * @param \Generated\Shared\Transfer\CustomerTransfer $customerTransfer
38
     * @param array<string> $restCustomersAttributesTransferData
39
     */
40
    public function assertCustomersAttributes(
41
        CustomerTransfer $customerTransfer,
42
        array $restCustomersAttributesTransferData,
43
    ): void {
44
        $restCustomersAttributesTransfer = (new RestCustomersAttributesTransfer())
45
            ->fromArray($restCustomersAttributesTransferData, true);
46
47
        $this->assertSame(
48
            $customerTransfer->getEmail(),
49
            $restCustomersAttributesTransfer->getEmail(),
50
        );
51
        $this->assertSame(
52
            $customerTransfer->getFirstName(),
53
            $restCustomersAttributesTransfer->getFirstName(),
54
        );
55
        $this->assertSame(
56
            $customerTransfer->getLastName(),
57
            $restCustomersAttributesTransfer->getLastName(),
58
        );
59
        $this->assertSame(
60
            substr($customerTransfer->getCreatedAt(), 0, 19),
61
            substr($restCustomersAttributesTransfer->getCreatedAt(), 0, 19),
62
        );
63
        $this->assertSame(
64
            substr($customerTransfer->getUpdatedAt(), 0, 19),
65
            substr($restCustomersAttributesTransfer->getUpdatedAt(), 0, 19),
66
        );
67
        $this->assertSame(
68
            $customerTransfer->getDateOfBirth(),
69
            $restCustomersAttributesTransfer->getDateOfBirth(),
70
        );
71
        $this->assertSame(
72
            $customerTransfer->getGender(),
73
            $restCustomersAttributesTransfer->getGender(),
74
        );
75
        $this->assertSame(
76
            $customerTransfer->getSalutation(),
77
            $restCustomersAttributesTransfer->getSalutation(),
78
        );
79
    }
80
}
81