GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Push — master ( b81ec7...cfabb3 )
by Andreas
03:47
created

ContactBuilderTest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 52
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
eloc 32
c 1
b 0
f 1
dl 0
loc 52
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A testBuildWithMagentoCustomer() 0 33 1
A testBuildWithSubscriber() 0 14 1
1
<?php
2
declare(strict_types=1);
3
/**
4
 */
5
6
namespace CommerceLeague\ActiveCampaign\Test\Unit\Gateway\Request;
7
8
use CommerceLeague\ActiveCampaign\Gateway\Request\ContactBuilder;
9
use Magento\Customer\Model\Customer;
10
use Magento\Newsletter\Model\Subscriber;
11
use PHPUnit\Framework\MockObject\MockObject;
12
use PHPUnit\Framework\TestCase;
13
14
class ContactBuilderTest extends TestCase
15
{
16
    public function testBuildWithMagentoCustomer()
17
    {
18
        $email = '[email protected]';
19
        $firstName = 'firstName';
20
        $lastName = 'lastName';
21
22
        /** @var MockObject|Customer $magentoCustomer */
23
        $magentoCustomer = $this->createMock(Customer::class);
24
25
        $magentoCustomer->expects($this->at(0))
26
            ->method('getData')
27
            ->with('email')
28
            ->willReturn($email);
29
30
        $magentoCustomer->expects($this->at(1))
31
            ->method('getData')
32
            ->with('firstname')
33
            ->willReturn($firstName);
34
35
        $magentoCustomer->expects($this->at(2))
36
            ->method('getData')
37
            ->with('lastname')
38
            ->willReturn($lastName);
39
40
        $expected = [
41
            'email' => $email,
42
            'firstName' => $firstName,
43
            'lastName' => $lastName
44
        ];
45
46
        $this->assertEquals(
47
            $expected,
48
            (new ContactBuilder())->buildWithMagentoCustomer($magentoCustomer)
49
        );
50
    }
51
52
    public function testBuildWithSubscriber()
53
    {
54
        /** @var MockObject|Subscriber $subscriber */
55
        $subscriber = $this->createMock(Subscriber::class);
56
57
        $email = '[email protected]';
58
59
        $subscriber->expects($this->once())
60
            ->method('getEmail')
61
            ->willReturn($email);
62
63
        $this->assertEquals(
64
            ['email' => $email],
65
            (new ContactBuilder())->buildWithSubscriber($subscriber)
66
        );
67
    }
68
69
}
70