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.

DataServiceFactoryTest   A
last analyzed

Complexity

Total Complexity 7

Size/Duplication

Total Lines 77
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

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

7 Methods

Rating   Name   Duplication   Size   Complexity  
A invalidInstancePathDataProvider() 0 11 1
A invalidDataServiceSchemeDataProvider() 0 10 1
A testGetDataServiceWithInvalidInstancePath() 0 4 1
A testGetDataServiceWithInvalidDataServiceScheme() 0 4 1
A testGetSSHDataService() 0 10 1
A testGetHTTPDataService() 0 9 1
A testGetHTTPSDataService() 0 9 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\Component\DataService;
12
13
use Gerrie\API\DataService\DataServiceFactory;
14
15
class DataServiceFactoryTest extends \PHPUnit_Framework_TestCase
16
{
17
18
    public function invalidInstancePathDataProvider()
19
    {
20
        $data = [
21
            array(['Instance' => null]),
22
            array(['Instance' => '']),
23
            array(['Instance' => '/foo/bar']),
24
            array(['Instance' => 'www.google.de/path/x'])
25
        ];
26
27
        return $data;
28
    }
29
30
    public function invalidDataServiceSchemeDataProvider()
31
    {
32
        $data = [
33
            array(['Instance' => 'google://my.website/']),
34
            array(['Instance' => 'ftp://192.168.1.1/']),
35
            array(['Instance' => 'sftp://ccc.de/'])
36
        ];
37
38
        return $data;
39
    }
40
41
    /**
42
     * @dataProvider invalidInstancePathDataProvider
43
     * @expectedException     \RuntimeException
44
     * @expectedExceptionCode 1415453791
45
     */
46
    public function testGetDataServiceWithInvalidInstancePath($instanceConfig)
47
    {
48
        DataServiceFactory::getDataService($instanceConfig);
49
    }
50
51
    /**
52
     * @dataProvider invalidDataServiceSchemeDataProvider
53
     * @expectedException     \RuntimeException
54
     * @expectedExceptionCode 1364130057
55
     */
56
    public function testGetDataServiceWithInvalidDataServiceScheme($instanceConfig)
57
    {
58
        DataServiceFactory::getDataService($instanceConfig);
59
    }
60
61
    public function testGetSSHDataService()
62
    {
63
        $instanceConfig = [
64
            'Instance' => 'ssh://[email protected]:29418/',
65
            'KeyFile' => '',
66
        ];
67
        $sshDataService = DataServiceFactory::getDataService($instanceConfig);
68
69
        $this->assertInstanceOf('Gerrie\API\DataService\SSHDataService', $sshDataService);
70
    }
71
72
    public function testGetHTTPDataService()
73
    {
74
        $instanceConfig = [
75
            'Instance' => 'http://andy.grunwald:[email protected]:80/'
76
        ];
77
        $httpDataService = DataServiceFactory::getDataService($instanceConfig);
78
79
        $this->assertInstanceOf('Gerrie\API\DataService\HTTPDataService', $httpDataService);
80
    }
81
82
    public function testGetHTTPSDataService()
83
    {
84
        $instanceConfig = [
85
            'Instance' => 'https://andy.grunwald:[email protected]:80/'
86
        ];
87
        $httpDataService = DataServiceFactory::getDataService($instanceConfig);
88
89
        $this->assertInstanceOf('Gerrie\API\DataService\HTTPDataService', $httpDataService);
90
    }
91
}