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.

APIConnectionCheckTest   A
last analyzed

Complexity

Total Complexity 8

Size/Duplication

Total Lines 56
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 8
lcom 1
cbo 3
dl 0
loc 56
rs 10
c 1
b 0
f 1

8 Methods

Rating   Name   Duplication   Size   Complexity  
A setUp() 0 5 1
A tearDown() 0 4 1
A getDataServiceMock() 0 9 1
A testCheckWithVersion() 0 4 1
A testCheckWithoutVersion() 0 7 1
A testGetFailureMessage() 0 4 1
A testGetSuccessMessage() 0 4 1
A testIsOptional() 0 4 1
1
<?php
2
/**
3
 * This file is part of the Gerrie package.
4
 *
5
 * (c) Andreas Grunwald <[email protected]>
6
 *
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 */
10
11
namespace Gerrie\Tests\Check;
12
13
use Gerrie\Check\APIConnectionCheck;
14
15
class APIConnectionCheckTest extends \PHPUnit_Framework_TestCase
16
{
17
    /**
18
     * @var \Gerrie\Check\CheckInterface
19
     */
20
    protected $checkInstance;
21
22
    public function setUp()
23
    {
24
        $apiConnectionMock = $this->getDataServiceMock();
25
        $this->checkInstance = new APIConnectionCheck($apiConnectionMock);
26
    }
27
28
    public function tearDown()
29
    {
30
        $this->checkInstance = null;
31
    }
32
33
    protected function getDataServiceMock($getVersionReturnValue = '1.2.3')
34
    {
35
        $apiConnectionMock = $this->getMock('Gerrie\API\DataService\DataServiceInterface');
36
        $apiConnectionMock->expects($this->any())
37
                          ->method('getVersion')
38
                          ->will($this->returnValue($getVersionReturnValue));
39
40
        return $apiConnectionMock;
41
    }
42
43
    public function testCheckWithVersion()
44
    {
45
        $this->assertTrue($this->checkInstance->check());
46
    }
47
48
    public function testCheckWithoutVersion()
49
    {
50
        $apiConnectionMock = $this->getDataServiceMock('');
51
        $checkInstance = new APIConnectionCheck($apiConnectionMock);
52
53
        $this->assertFalse($checkInstance->check());
54
    }
55
56
    public function testGetFailureMessage()
57
    {
58
        $this->assertInternalType('string', $this->checkInstance->getFailureMessage());
59
    }
60
61
    public function testGetSuccessMessage()
62
    {
63
        $this->assertInternalType('string', $this->checkInstance->getSuccessMessage());
64
    }
65
66
    public function testIsOptional()
67
    {
68
        $this->assertInternalType('bool', $this->checkInstance->isOptional());
69
    }
70
}