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 ( 71cc31...7de261 )
by François
04:22
created

ConnectionTest::testAclIsMember()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 14
Code Lines 9

Duplication

Lines 14
Ratio 100 %

Importance

Changes 0
Metric Value
cc 1
eloc 9
nc 1
nop 0
dl 14
loc 14
rs 9.4285
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;
19
20
require_once sprintf('%s/Test/TestHttpClient.php', __DIR__);
21
22
use PHPUnit_Framework_TestCase;
23
use SURFnet\VPN\Common\HttpClient\ServerClient;
24
use Psr\Log\NullLogger;
25
use SURFnet\VPN\Server\Test\TestHttpClient;
26
27
class ConnectionTest extends PHPUnit_Framework_TestCase
28
{
29
    /** @var Connection */
30
    private $connection;
31
32
    public function setUp()
33
    {
34
        $this->connection = new Connection(
35
            new NullLogger(),
36
            new ServerClient(
37
                new TestHttpClient(),
38
                'connectionServerClient'
39
            )
40
        );
41
    }
42
43 View Code Duplication
    public function testValidConnection()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
44
    {
45
        $this->assertTrue(
46
            $this->connection->connect(
47
                [
48
                    'common_name' => 'foo_bar',
49
                    'POOL_ID' => 'internet',
50
                    'time_unix' => '12345678',
51
                    'ifconfig_pool_remote_ip' => '10.0.42.0',
52
                    'ifconfig_pool_remote_ip6' => 'fd00:4242:4242:4242::',
53
                ]
54
            )
55
        );
56
    }
57
58 View Code Duplication
    public function testDisabledUser()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
59
    {
60
        $this->assertFalse(
61
            $this->connection->connect(
62
                [
63
                    'common_name' => 'bar_bar',
64
                    'POOL_ID' => 'internet',
65
                    'time_unix' => '12345678',
66
                    'ifconfig_pool_remote_ip' => '10.0.42.0',
67
                    'ifconfig_pool_remote_ip6' => 'fd00:4242:4242:4242::',
68
                ]
69
            )
70
        );
71
    }
72
73 View Code Duplication
    public function testDisabledCommonName()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
74
    {
75
        $this->assertFalse(
76
            $this->connection->connect(
77
                [
78
                    'common_name' => 'foo_baz',
79
                    'POOL_ID' => 'internet',
80
                    'time_unix' => '12345678',
81
                    'ifconfig_pool_remote_ip' => '10.0.42.0',
82
                    'ifconfig_pool_remote_ip6' => 'fd00:4242:4242:4242::',
83
                ]
84
            )
85
        );
86
    }
87
88 View Code Duplication
    public function testAclValid()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
89
    {
90
        $this->assertTrue(
91
            $this->connection->connect(
92
                [
93
                    'common_name' => 'foo_bar',
94
                    'POOL_ID' => 'acl',
95
                    'time_unix' => '12345678',
96
                    'ifconfig_pool_remote_ip' => '10.0.42.0',
97
                    'ifconfig_pool_remote_ip6' => 'fd00:4242:4242:4242::',
98
                ]
99
            )
100
        );
101
    }
102
103 View Code Duplication
    public function testAclInvalid()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
104
    {
105
        $this->assertFalse(
106
            $this->connection->connect(
107
                [
108
                    'common_name' => 'foo_bar',
109
                    'POOL_ID' => 'acl2',
110
                    'time_unix' => '12345678',
111
                    'ifconfig_pool_remote_ip' => '10.0.42.0',
112
                    'ifconfig_pool_remote_ip6' => 'fd00:4242:4242:4242::',
113
                ]
114
            )
115
        );
116
    }
117
118
    public function testDisconnect()
119
    {
120
        $this->assertTrue(
121
            $this->connection->disconnect(
122
                [
123
                    'common_name' => 'foo_bar',
124
                    'POOL_ID' => 'acl2',
125
                    'time_unix' => '12345678',
126
                    'ifconfig_pool_remote_ip' => '10.0.42.0',
127
                    'ifconfig_pool_remote_ip6' => 'fd00:4242:4242:4242::',
128
                    'time_duration' => '3600',
129
                    'bytes_sent' => '123456',
130
                    'bytes_received' => '444444',
131
                ]
132
            )
133
        );
134
    }
135
}
136