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.
Completed
Push — master ( e0a7c0...a60ee2 )
by François
02:23
created

ServerManagerTest::setUp()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
0 ignored issues
show
Coding Style Compatibility introduced by
For compatibility and reusability of your code, PSR1 recommends that a file should introduce either new symbols (like classes, functions, etc.) or have side-effects (like outputting something, or including other files), but not both at the same time. The first symbol is defined on line 27 and the first side effect is on line 20.

The PSR-1: Basic Coding Standard recommends that a file should either introduce new symbols, that is classes, functions, constants or similar, or have side effects. Side effects are anything that executes logic, like for example printing output, changing ini settings or writing to a file.

The idea behind this recommendation is that merely auto-loading a class should not change the state of an application. It also promotes a cleaner style of programming and makes your code less prone to errors, because the logic is not spread out all over the place.

To learn more about the PSR-1, please see the PHP-FIG site on the PSR-1.

Loading history...
2
/**
3
 *  Copyright (C) 2016 SURFnet.
4
 *
5
 *  This program is free software: you can redistribute it and/or modify
6
 *  it under the terms of the GNU Affero General Public License as
7
 *  published by the Free Software Foundation, either version 3 of the
8
 *  License, or (at your option) any later version.
9
 *
10
 *  This program is distributed in the hope that it will be useful,
11
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 *  GNU Affero General Public License for more details.
14
 *
15
 *  You should have received a copy of the GNU Affero General Public License
16
 *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
17
 */
18
namespace SURFnet\VPN\Server\OpenVpn;
19
20
require_once sprintf('%s/Test/TestSocket.php', __DIR__);
21
22
use PHPUnit_Framework_TestCase;
23
use SURFnet\VPN\Server\OpenVpn\Test\TestSocket;
24
use Psr\Log\NullLogger;
25
use SURFnet\VPN\Server\InstanceConfig;
26
27
class ServerManagerTest extends PHPUnit_Framework_TestCase
28
{
29
    public function setUp()
30
    {
31
    }
32
33
    public function testGetStatus()
34
    {
35
        $serverManager = new ServerManager(
36
            new InstanceConfig(
37
                [
38
                    'instanceNumber' => 1,
39
                    'vpnPools' => [
40
                        'default' => [
41
                            'name' => 'Default Instance',
42
                            'hostName' => 'vpn.example',
43
                            'extIf' => 'eth0',
44
                            'range' => '10.42.42.0/24',
45
                            'range6' => 'fd00:4242:4242::/48',
46
                            'dns' => ['8.8.8.8', '2001:4860:4860::8888'],
47
                            'routes' => ['192.168.1.0/24', 'fd00:1010:1010::/48'],
48
                        ],
49
                    ],
50
                ]
51
            ),
52
            new TestSocket('connections'),
53
            new NullLogger()
54
        );
55
56
        $this->assertSame(
57
            [
58
                [
59
                    'id' => 'default',
60
                    'connections' => [
61
                        [
62
                            'common_name' => 'fkooman_samsung_i9300',
63
                            'user_id' => 'fkooman',
64
                            'name' => 'samsung_i9300',
65
                            'real_address' => '91.64.87.183:43103',
66
                            'bytes_in' => 18301,
67
                            'bytes_out' => 30009,
68
                            'connected_since' => 1451323167,
69
                            'virtual_address' => [
70
                                'fd00:4242:4242::1003',
71
                                '10.42.42.5',
72
                            ],
73
                        ],
74
                    ],
75
                ],
76
            ],
77
            $serverManager->connections()
78
        );
79
    }
80
81
//    public function testKillClient()
0 ignored issues
show
Unused Code Comprehensibility introduced by
52% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
82
//    {
83
//        $this->addModule('kill');
84
//        $this->assertSame(
85
//            [
86
//                'data' => [
87
//                    'ok' => true,
88
//                ],
89
//            ],
90
//            $this->makeRequest('POST', '/openvpn/kill', ['common_name' => 'xyz'])
91
//        );
92
//    }
93
94
//    private function makeRequest($requestMethod, $requestUri, array $queryBody = [])
0 ignored issues
show
Unused Code Comprehensibility introduced by
50% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
95
//    {
96
//        if ('GET' === $requestMethod || 'DELETE' === $requestMethod) {
97
//            return $this->service->run(
98
//                new Request(
99
//                    array(
100
//                        'SERVER_NAME' => 'www.example.org',
101
//                        'SERVER_PORT' => 80,
102
//                        'REQUEST_METHOD' => $requestMethod,
103
//                        'REQUEST_URI' => sprintf('%s?%s', $requestUri, http_build_query($queryBody)),
104
//                        'PATH_INFO' => $requestUri,
105
//                        'QUERY_STRING' => http_build_query($queryBody),
106
//                        'HTTP_AUTHORIZATION' => sprintf('Bearer %s', 'aabbcc'),
107
//                    )
108
//                )
109
//            )->getBody();
110
//        } else {
111
//            // POST
112
//            return $this->service->run(
113
//                new Request(
114
//                    array(
115
//                        'SERVER_NAME' => 'www.example.org',
116
//                        'SERVER_PORT' => 80,
117
//                        'REQUEST_METHOD' => $requestMethod,
118
//                        'REQUEST_URI' => $requestUri,
119
//                        'PATH_INFO' => $requestUri,
120
//                        'QUERY_STRING' => '',
121
//                        'HTTP_AUTHORIZATION' => sprintf('Bearer %s', 'aabbcc'),
122
//                    ),
123
//                    $queryBody
124
//                )
125
//            )->getBody();
126
//        }
127
//    }
128
129
//    private function addModule($callType)
0 ignored issues
show
Unused Code Comprehensibility introduced by
50% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
130
//    {
131
//        $p = new Pools(
132
//            [
133
//                'default' => [
134
//                    'name' => 'Default Instance',
135
//                    'hostName' => 'vpn.example',
136
//                    'extIf' => 'eth0',
137
//                    'range' => '10.42.42.0/24',
138
//                    'range6' => 'fd00:4242:4242::/48',
139
//                    'dns' => ['8.8.8.8', '2001:4860:4860::8888'],
140
//                    'routes' => ['192.168.1.0/24', 'fd00:1010:1010::/48'],
141
//                ],
142
//            ]
143
//        );
144
145
//        $socket = new TestSocket($callType);
0 ignored issues
show
Unused Code Comprehensibility introduced by
52% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
146
//        $serverManager = new ServerManager($p, $socket, new NullLogger());
147
148
//        $this->service->addModule(
0 ignored issues
show
Unused Code Comprehensibility introduced by
43% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
149
//            new OpenVpnModule(
150
//                $serverManager
151
//            )
152
//        );
153
//    }
154
}
155