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 ( fb8f78...f9a184 )
by Andreas
03:45
created

SyncContactObserverTest::setUp()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 11
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
cc 1
eloc 8
nc 1
nop 0
dl 0
loc 11
rs 10
c 1
b 0
f 1
1
<?php
2
declare(strict_types=1);
3
/**
4
 */
5
6
namespace CommerceLeague\ActiveCampaign\Test\Observer\Customer;
7
8
use CommerceLeague\ActiveCampaign\Helper\Config as ConfigHelper;
9
use CommerceLeague\ActiveCampaign\Observer\Customer\SyncContactObserver;
10
use CommerceLeague\ActiveCampaign\Service\Contact\SyncContactService;
11
use Magento\Customer\Model\Customer;
12
use Magento\Framework\Event;
13
use Magento\Framework\Event\Observer;
14
use PHPUnit\Framework\MockObject\MockObject;
15
use PHPUnit\Framework\TestCase;
16
17
class SyncContactObserverTest extends TestCase
18
{
19
    /**
20
     * @var MockObject|ConfigHelper
21
     */
22
    protected $configHelper;
23
24
    /**
25
     * @var MockObject|SyncContactService
26
     */
27
    protected $syncContactService;
28
29
    /**
30
     * @var MockObject|Observer
31
     */
32
    protected $observer;
33
34
    /**
35
     * @var MockObject|Event
36
     */
37
    protected $event;
38
39
    /**
40
     * @var MockObject|Customer
41
     */
42
    protected $customer;
43
44
    /**
45
     * @var SyncContactService
46
     */
47
    protected $syncContactObserver;
48
49
    protected function setUp()
50
    {
51
        $this->configHelper = $this->createMock(ConfigHelper::class);
52
        $this->syncContactService = $this->createMock(SyncContactService::class);
53
        $this->observer = $this->createMock(Observer::class);
54
        $this->event = $this->createMock(Event::class);
55
        $this->customer = $this->createMock(Customer::class);
56
57
        $this->syncContactObserver = new SyncContactObserver(
0 ignored issues
show
Documentation Bug introduced by
It seems like new CommerceLeague\Activ...is->syncContactService) of type CommerceLeague\ActiveCam...mer\SyncContactObserver is incompatible with the declared type CommerceLeague\ActiveCam...tact\SyncContactService of property $syncContactObserver.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
58
            $this->configHelper,
59
            $this->syncContactService
60
        );
61
    }
62
63
    public function testExecuteApiDisabled()
64
    {
65
        $this->configHelper->expects($this->once())
0 ignored issues
show
Bug introduced by
The method expects() does not exist on CommerceLeague\ActiveCampaign\Helper\Config. ( Ignorable by Annotation )

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

65
        $this->configHelper->/** @scrutinizer ignore-call */ 
66
                             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...
66
            ->method('isApiEnabled')
67
            ->willReturn(false);
68
69
        $this->observer->expects($this->never())
70
            ->method('getEvent');
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

70
            ->/** @scrutinizer ignore-call */ method('getEvent');

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...
71
72
        $this->syncContactObserver->execute($this->observer);
0 ignored issues
show
Bug introduced by
The method execute() does not exist on CommerceLeague\ActiveCam...tact\SyncContactService. ( Ignorable by Annotation )

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

72
        $this->syncContactObserver->/** @scrutinizer ignore-call */ 
73
                                    execute($this->observer);

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...
73
    }
74
75
    public function testExecute()
76
    {
77
        $this->configHelper->expects($this->once())
78
            ->method('isApiEnabled')
79
            ->willReturn(true);
80
81
        $this->observer->expects($this->once())
82
            ->method('getEvent')
83
            ->willReturn($this->event);
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

83
            ->/** @scrutinizer ignore-call */ willReturn($this->event);

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...
84
85
        $this->event->expects($this->once())
86
            ->method('getData')
87
            ->with('customer')
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

87
            ->/** @scrutinizer ignore-call */ with('customer')

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...
88
            ->willReturn($this->customer);
89
90
        $this->syncContactService->expects($this->once())
0 ignored issues
show
Bug introduced by
The method expects() does not exist on CommerceLeague\ActiveCam...tact\SyncContactService. ( Ignorable by Annotation )

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

90
        $this->syncContactService->/** @scrutinizer ignore-call */ 
91
                                   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...
91
            ->method('syncWithMagentoCustomer')
92
            ->with($this->customer);
93
94
        $this->syncContactObserver->execute($this->observer);
95
    }
96
}
97