Passed
Pull Request — master (#356)
by Denys
05:13
created

CustomerApiTester   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 48
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 1
eloc 28
dl 0
loc 48
rs 10
c 1
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A assertCustomersAttributes() 0 38 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
namespace PyzTest\Glue\Customer;
9
10
use Generated\Shared\Transfer\CustomerTransfer;
11
use Generated\Shared\Transfer\RestCustomersAttributesTransfer;
12
use SprykerTest\Glue\Testify\Tester\ApiEndToEndTester;
13
14
/**
15
 * Inherited Methods
16
 *
17
 * @method void wantToTest($text)
18
 * @method void wantTo($text)
19
 * @method void execute($callable)
20
 * @method void expectTo($prediction)
21
 * @method void expect($prediction)
22
 * @method void amGoingTo($argumentation)
23
 * @method void am($role)
24
 * @method void lookForwardTo($achieveValue)
25
 * @method void comment($description)
26
 * @method void pause()
27
 *
28
 * @SuppressWarnings(\PyzTest\Glue\Customer\PHPMD)
29
 */
30
class CustomerApiTester extends ApiEndToEndTester
31
{
32
    use _generated\CustomerApiTesterActions;
33
34
    /**
35
     * @param \Generated\Shared\Transfer\CustomerTransfer $customerTransfer
36
     * @param array<string> $restCustomersAttributesTransferData
37
     *
38
     * @return void
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