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.
Passed
Push — master ( f51f95...468920 )
by Andreas
03:39
created

ConfigTest::testIsApiEnabledTrue()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 5
dl 0
loc 8
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
/**
3
 */
4
5
namespace CommerceLeague\ActiveCampaign\Test\Unit\Helper;
6
7
use CommerceLeague\ActiveCampaign\Helper\Config;
8
use Magento\Framework\App\Config\ScopeConfigInterface;
9
use Magento\Framework\TestFramework\Unit\Helper\ObjectManager;
10
use PHPUnit\Framework\MockObject\MockObject;
11
use PHPUnit\Framework\TestCase;
12
13
class ConfigTest extends TestCase
14
{
15
    /**
16
     * @var MockObject|ScopeConfigInterface
17
     */
18
    protected $scopeConfig;
19
20
    /**
21
     * @var Config
22
     */
23
    protected $config;
24
25
    protected function setUp()
26
    {
27
        $this->scopeConfig = $this->createPartialMock(
28
            ScopeConfigInterface::class,
29
            ['getValue', 'isSetFlag']
30
        );
31
32
        $objectManager = new ObjectManager($this);
33
34
        $this->config = $objectManager->getObject(
35
            Config::class,
36
            [
37
                'scopeConfig' => $this->scopeConfig
38
            ]
39
        );
40
    }
41
42
    public function testIsEnabledFalse()
43
    {
44
        $this->scopeConfig->expects($this->once())
0 ignored issues
show
Bug introduced by
The method expects() does not exist on Magento\Framework\App\Config\ScopeConfigInterface. ( Ignorable by Annotation )

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

44
        $this->scopeConfig->/** @scrutinizer ignore-call */ 
45
                            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...
45
            ->method('isSetFlag')
46
            ->with('activecampaign/general/enabled')
47
            ->willReturn(false);
48
49
        $this->assertFalse($this->config->isEnabled());
50
    }
51
52
    public function testIsEnabledTrue()
53
    {
54
        $this->scopeConfig->expects($this->once())
55
            ->method('isSetFlag')
56
            ->with('activecampaign/general/enabled')
57
            ->willReturn(true);
58
59
        $this->assertTrue($this->config->isEnabled());
60
    }
61
62
    public function testGetApiUrl()
63
    {
64
        $apiUrl = 'http://example.com';
65
66
        $this->scopeConfig->expects($this->once())
67
            ->method('getValue')
68
            ->with('activecampaign/general/api_url')
69
            ->willReturn($apiUrl);
70
71
        $this->assertEquals($apiUrl, $this->config->getApiUrl());
72
    }
73
74
    public function testGetApiToken()
75
    {
76
        $apiToken = 'API_TOKEN';
77
78
        $this->scopeConfig->expects($this->once())
79
            ->method('getValue')
80
            ->with('activecampaign/general/api_token')
81
            ->willReturn($apiToken);
82
83
        $this->assertEquals($apiToken, $this->config->getApiToken());
84
    }
85
86
    public function testGetConnectionId()
87
    {
88
        $connectionId = '123';
89
90
        $this->scopeConfig->expects($this->once())
91
            ->method('getValue')
92
            ->with('activecampaign/general/connection_id')
93
            ->willReturn($connectionId);
94
95
        $this->assertEquals($connectionId, $this->config->getConnectionId());
96
    }
97
98
    public function getAbandonedCartExportAfter()
99
    {
100
        $exportAfter = 15;
101
102
        $this->scopeConfig->expects($this->once())
103
            ->method('getValue')
104
            ->with('activecampaign/abandoned_cart/export_after')
105
            ->willReturn($exportAfter);
106
107
        $this->assertEquals($exportAfter, $this->config->getAbandonedCartExportAfter());
108
    }
109
}
110