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.

ConfigFileValidationCheckTest   A
last analyzed

Complexity

Total Complexity 8

Size/Duplication

Total Lines 77
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

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

8 Methods

Rating   Name   Duplication   Size   Complexity  
A setUp() 0 5 1
A tearDown() 0 4 1
A getConfigurationMock() 0 22 1
A testCheckWithAllProperties() 0 6 1
A testCheckWithMissingProperties() 0 4 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\ConfigurationValidationCheck;
14
15
class ConfigFileValidationCheckTest extends \PHPUnit_Framework_TestCase
16
{
17
18
    /**
19
     * @var \Gerrie\Check\CheckInterface
20
     */
21
    protected $checkInstance;
22
23
    public function setUp()
24
    {
25
        $configuration = $this->getConfigurationMock();
26
        $this->checkInstance = new ConfigurationValidationCheck($configuration);
27
    }
28
29
    public function tearDown()
30
    {
31
        $this->checkInstance = null;
32
    }
33
34
    public function getConfigurationMock($allTrue = false)
35
    {
36
        $configuration = $this->getMock('Gerrie\Component\Configuration\Configuration', ['hasConfigurationKey']);
37
        $configuration->expects($this->any())
38
            ->method('hasConfigurationKey')
39
            ->withConsecutive(
40
                array($this->equalTo('Database.Host')),
41
                array($this->equalTo('Database.Username')),
42
                array($this->equalTo('Database.Password')),
43
                array($this->equalTo('Database.Port')),
44
                array($this->equalTo('Database.Name'))
45
            )
46
            ->willReturnOnConsecutiveCalls(
47
                $this->returnValue(true),
48
                $this->returnValue(true),
49
                $this->returnValue($allTrue),
50
                $this->returnValue(true),
51
                $this->returnValue($allTrue)
52
            );
53
54
        return $configuration;
55
    }
56
57
    public function testCheckWithAllProperties()
58
    {
59
        $configuration = $this->getConfigurationMock(true);
60
        $configFileValidationCheck = new ConfigurationValidationCheck($configuration);
61
        $this->assertTrue($configFileValidationCheck->check());
62
    }
63
64
    public function testCheckWithMissingProperties()
65
    {
66
        $this->assertFalse($this->checkInstance->check());
67
    }
68
69
    /*
70
    public function testWithNotExistingConfigCheck()
71
    {
72
        $checkInstance = new ConfigFileCheck('');
73
        $this->assertFalse($checkInstance->check());
74
    }
75
    */
76
77
    public function testGetFailureMessage()
78
    {
79
        $this->assertInternalType('string', $this->checkInstance->getFailureMessage());
80
    }
81
82
    public function testGetSuccessMessage()
83
    {
84
        $this->assertInternalType('string', $this->checkInstance->getSuccessMessage());
85
    }
86
87
    public function testIsOptional()
88
    {
89
        $this->assertInternalType('bool', $this->checkInstance->isOptional());
90
    }
91
}