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 ( 5543fb...d29718 )
by Andreas
03:19
created

testExecuteApiEnabled()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 20
Code Lines 14

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 14
c 1
b 0
f 0
dl 0
loc 20
rs 9.7998
cc 1
nc 1
nop 0
1
<?php
2
/**
3
 */
4
5
namespace CommerceLeague\ActiveCampaign\Test\Unit\Observer\Customer;
6
7
use CommerceLeague\ActiveCampaign\Helper\Config as ConfigHelper;
8
use CommerceLeague\ActiveCampaign\Observer\CustomerSaveAfterObserver;
9
use CommerceLeague\ActiveCampaign\Service\Contact\CreateUpdateContactService;
10
use Magento\Customer\Model\Customer;
11
use Magento\Framework\Event;
12
use Magento\Framework\Event\Observer;
13
use PHPUnit\Framework\MockObject\MockObject;
14
use PHPUnit\Framework\TestCase;
15
16
/**
17
 * Class CustomerSaveAfterObserverTest
18
 */
19
class CustomerSaveAfterObserverTest extends TestCase
20
{
21
    /**
22
     * @var MockObject|ConfigHelper
23
     */
24
    protected $configHelper;
25
26
    /**
27
     * @var MockObject|CreateUpdateContactService
28
     */
29
    protected $createUpdateContactService;
30
31
    /**
32
     * @var MockObject|Observer
33
     */
34
    protected $observer;
35
36
    /**
37
     * @var MockObject|Event
38
     */
39
    protected $event;
40
41
    /**
42
     * @var MockObject|Customer
43
     */
44
    protected $customer;
45
46
    /**
47
     * @var CustomerSaveAfterObserver
48
     */
49
    protected $createUpdateContactObserver;
50
51
    protected function setUp()
52
    {
53
        $this->configHelper = $this->createMock(ConfigHelper::class);
54
        $this->createUpdateContactService = $this->createMock(CreateUpdateContactService::class);
55
        $this->observer = $this->createMock(Observer::class);
56
        $this->event = $this->createMock(Event::class);
57
        $this->customer = $this->createMock(Customer::class);
58
59
        $this->createUpdateContactObserver = new CustomerSaveAfterObserver(
60
            $this->configHelper,
61
            $this->createUpdateContactService
62
        );
63
    }
64
65
    public function testExecuteApiNotEnabled()
66
    {
67
        $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

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

72
            ->/** @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...
73
74
        $this->createUpdateContactObserver->execute($this->observer);
75
    }
76
77
    public function testExecuteApiEnabled()
78
    {
79
        $this->configHelper->expects($this->once())
80
            ->method('isApiEnabled')
81
            ->willReturn(true);
82
83
        $this->observer->expects($this->once())
84
            ->method('getEvent')
85
            ->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

85
            ->/** @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...
86
87
        $this->event->expects($this->once())
88
            ->method('getData')
89
            ->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

89
            ->/** @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...
90
            ->willReturn($this->customer);
91
92
        $this->createUpdateContactService->expects($this->once())
0 ignored issues
show
Bug introduced by
The method expects() does not exist on CommerceLeague\ActiveCam...ateUpdateContactService. ( Ignorable by Annotation )

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

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