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::getDataServiceMock()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
dl 0
loc 9
rs 9.6666
c 1
b 0
f 1
cc 1
eloc 6
nc 1
nop 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
}