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

ExportCustomerServiceTest::setUp()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
cc 1
eloc 5
c 1
b 0
f 1
nc 1
nop 0
dl 0
loc 7
rs 10
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\ExportCustomerService;
10
use Magento\Customer\Model\Customer;
11
use Magento\Framework\MessageQueue\PublisherInterface;
12
use PHPUnit\Framework\MockObject\MockObject;
13
use PHPUnit\Framework\TestCase;
14
use CommerceLeague\ActiveCampaign\Gateway\Request\CustomerBuilder as CustomerRequestBuilder;
15
16
class ExportCustomerServiceTest extends TestCase
17
{
18
    /**
19
     * @var MockObject|CustomerRequestBuilder
20
     */
21
    protected $customerRequestBuilder;
22
23
    /**
24
     * @var MockObject|PublisherInterface
25
     */
26
    protected $publisher;
27
28
    /**
29
     * @var ExportCustomerService
30
     */
31
    protected $exportCustomerService;
32
33
    protected function setUp()
34
    {
35
        $this->customerRequestBuilder = $this->createMock(CustomerRequestBuilder::class);
36
        $this->publisher = $this->createMock(PublisherInterface::class);
37
        $this->exportCustomerService = new ExportCustomerService(
38
            $this->customerRequestBuilder,
39
            $this->publisher
40
        );
41
    }
42
43
    public function testExport()
44
    {
45
        /** @var MockObject|Customer $magentoCustomer */
46
        $magentoCustomer = $this->createMock(Customer::class);
47
48
        $magentoCustomerId = 123;
49
        $request = ['request'];
50
51
        $magentoCustomer->expects($this->once())
52
            ->method('getId')
53
            ->willReturn($magentoCustomerId);
54
55
        $this->customerRequestBuilder->expects($this->once())
0 ignored issues
show
Bug introduced by
The method expects() does not exist on CommerceLeague\ActiveCam...Request\CustomerBuilder. ( Ignorable by Annotation )

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

55
        $this->customerRequestBuilder->/** @scrutinizer ignore-call */ 
56
                                       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...
56
            ->method('build')
57
            ->with($magentoCustomer)
58
            ->willReturn($request);
59
60
        $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

60
        $this->publisher->/** @scrutinizer ignore-call */ 
61
                          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...
61
            ->method('publish')
62
            ->with(
63
                Topics::CUSTOMER_EXPORT,
64
                json_encode(['magento_customer_id' => $magentoCustomerId, 'request' => $request])
65
            );
66
67
        $this->exportCustomerService->export($magentoCustomer);
68
    }
69
}
70
71