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 ( ad4463...4d14c7 )
by Andreas
03:15
created

ContactRequestBuilderTest   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 71
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 36
dl 0
loc 71
rs 10
c 0
b 0
f 0
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A testBuildWithSubscriber() 0 13 1
A testBuildWithCustomer() 0 31 1
A setUp() 0 5 1
1
<?php
2
3
namespace CommerceLeague\ActiveCampaign\Test\Unit\Gateway\Request;
4
5
use CommerceLeague\ActiveCampaign\Gateway\Request\ContactRequestBuilder;
6
use Magento\Customer\Model\Customer;
7
use Magento\Newsletter\Model\Subscriber;
8
use PHPUnit\Framework\MockObject\MockObject;
9
use PHPUnit\Framework\TestCase;
10
11
/**
12
 */
13
class ContactRequestBuilderTest extends TestCase
14
{
15
    /**
16
     * @var MockObject|Customer
17
     */
18
    protected $customer;
19
20
    /**
21
     * @var MockObject|Subscriber
22
     */
23
    protected $subscriber;
24
25
    /**
26
     * @var ContactRequestBuilder
27
     */
28
    protected $contactRequestBuilder;
29
30
    protected function setUp()
31
    {
32
        $this->customer = $this->createMock(Customer::class);
33
        $this->subscriber = $this->createMock(Subscriber::class);
34
        $this->contactRequestBuilder = new ContactRequestBuilder();
35
    }
36
37
    public function testBuildWithCustomer()
38
    {
39
        $email = '[email protected]';
40
        $firstName = 'John';
41
        $lasName = 'Doe';
42
43
        $this->customer->expects($this->at(0))
44
            ->method('getData')
0 ignored issues
show
Bug introduced by
The method method() does not exist on PHPUnit\Framework\MockObject\MockObject. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

44
            ->/** @scrutinizer ignore-call */ method('getData')

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
45
            ->with('email')
0 ignored issues
show
Bug introduced by
The method with() does not exist on PHPUnit\Framework\MockObject\MockObject. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

45
            ->/** @scrutinizer ignore-call */ with('email')

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
46
            ->willReturn($email);
0 ignored issues
show
Bug introduced by
The method willReturn() does not exist on PHPUnit\Framework\MockObject\MockObject. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

46
            ->/** @scrutinizer ignore-call */ willReturn($email);

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
47
48
        $this->customer->expects($this->at(1))
49
            ->method('getData')
50
            ->with('firstname')
51
            ->willReturn($firstName);
52
53
        $this->customer->expects($this->at(2))
54
            ->method('getData')
55
            ->with('lastname')
56
            ->willReturn($lasName);
57
58
        $this->customer->expects($this->exactly(3))
59
            ->method('getData');
60
61
        $this->assertEquals(
62
            [
63
                'email' => $email,
64
                'firstName' => $firstName,
65
                'lastName' => $lasName
66
            ],
67
            $this->contactRequestBuilder->buildWithCustomer($this->customer)
68
        );
69
    }
70
71
    public function testBuildWithSubscriber()
72
    {
73
        $email = '[email protected]';
74
75
        $this->subscriber->expects($this->once())
76
            ->method('getEmail')
77
            ->willReturn($email);
78
79
        $this->assertEquals(
80
            [
81
                'email' => $email
82
            ],
83
            $this->contactRequestBuilder->buildWithSubscriber($this->subscriber)
84
        );
85
    }
86
}
87