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

testExportWithMagentoCustomer()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 25
Code Lines 17

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
cc 1
eloc 17
c 1
b 0
f 1
nc 1
nop 0
dl 0
loc 25
rs 9.7
1
<?php
2
declare(strict_types=1);
3
/**
4
 */
5
6
namespace CommerceLeague\ActiveCampaign\Test\Unit\Service;
7
8
use CommerceLeague\ActiveCampaign\MessageQueue\Topics;
9
use CommerceLeague\ActiveCampaign\Service\ExportContactService;
10
use Magento\Customer\Model\Customer;
11
use Magento\Framework\MessageQueue\PublisherInterface;
12
use Magento\Newsletter\Model\Subscriber;
13
use PHPUnit\Framework\MockObject\MockObject;
14
use PHPUnit\Framework\TestCase;
15
use CommerceLeague\ActiveCampaign\Gateway\Request\ContactBuilder as ContactRequestBuilder;
16
17
class ExportContactServiceTest extends TestCase
18
{
19
    /**
20
     * @var MockObject|ContactRequestBuilder
21
     */
22
    protected $contactRequestBuilder;
23
24
    /**
25
     * @var MockObject|PublisherInterface
26
     */
27
    protected $publisher;
28
29
    /**
30
     * @var ExportContactService
31
     */
32
    protected $exportContactService;
33
34
    protected function setUp()
35
    {
36
        $this->contactRequestBuilder = $this->createMock(ContactRequestBuilder::class);
37
        $this->publisher = $this->createMock(PublisherInterface::class);
38
        $this->exportContactService = new ExportContactService(
39
            $this->contactRequestBuilder,
40
            $this->publisher
41
        );
42
    }
43
44
    public function testExportWithMagentoCustomer()
45
    {
46
        /** @var MockObject|Customer $magentoCustomer */
47
        $magentoCustomer = $this->createMock(Customer::class);
48
49
        $email = '[email protected]';
50
        $request = ['request'];
51
52
        $magentoCustomer->expects($this->once())
53
            ->method('getData')
54
            ->with('email')
55
            ->willReturn($email);
56
57
        $this->contactRequestBuilder->expects($this->once())
0 ignored issues
show
Bug introduced by
The method expects() does not exist on CommerceLeague\ActiveCam...\Request\ContactBuilder. ( Ignorable by Annotation )

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

57
        $this->contactRequestBuilder->/** @scrutinizer ignore-call */ 
58
                                      expects($this->once())

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...
58
            ->method('buildWithMagentoCustomer')
59
            ->with($magentoCustomer)
60
            ->willReturn($request);
61
62
        $this->publisher->expects($this->once())
0 ignored issues
show
Bug introduced by
The method expects() does not exist on Magento\Framework\MessageQueue\PublisherInterface. ( Ignorable by Annotation )

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

62
        $this->publisher->/** @scrutinizer ignore-call */ 
63
                          expects($this->once())

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...
63
            ->method('publish')
64
            ->with(
65
                Topics::CONTACT_EXPORT,
66
                json_encode(['email' => $email, 'request' => $request]));
67
68
        $this->exportContactService->exportWithMagentoCustomer($magentoCustomer);
69
    }
70
71
    public function testExportWithSubscriber()
72
    {
73
        /** @var MockObject|Subscriber $subscriber */
74
        $subscriber = $this->createMock(Subscriber::class);
75
76
        $email = '[email protected]';
77
        $request = ['request'];
78
79
        $subscriber->expects($this->once())
80
            ->method('getEmail')
81
            ->willReturn($email);
82
83
        $this->contactRequestBuilder->expects($this->once())
84
            ->method('buildWithSubscriber')
85
            ->with($subscriber)
86
            ->willReturn($request);
87
88
        $this->publisher->expects($this->once())
89
            ->method('publish')
90
            ->with(
91
                Topics::CONTACT_EXPORT,
92
                json_encode(['email' => $email, 'request' => $request])
93
            );
94
95
        $this->exportContactService->exportWithSubscriber($subscriber);
96
    }
97
}
98