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.
Passed
Push — master ( a5b504...99f733 )
by Dejan
02:54
created

UserAgentTest::os_delegatesReturnValue()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 11
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 11
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 7
nc 1
nop 0
1
<?php
2
namespace Fam\Util\UserAgentParser;
3
4
use PHPUnit\Framework\TestCase;
5
6
class UserAgentTest extends TestCase
7
{
8
    /**
9
     * @test
10
     */
11
    public function os_delegatesReturnValue()
0 ignored issues
show
Coding Style introduced by
Method name "UserAgentTest::os_delegatesReturnValue" is not in camel caps format
Loading history...
12
    {
13
        $operatingSystem = $this->createOperatingSystemMock();
14
15
        $operatingSystem->expects($this->once())
16
            ->method('getName')
17
            ->will($this->returnValue(__METHOD__));
18
19
        $userAgent = new UserAgent($operatingSystem, $this->createWebClientMock());
20
        $this->assertEquals(__METHOD__, $userAgent->os());
21
    }
22
23
    /**
24
     * @test
25
     */
26
    public function isOs_delegatesArgumentToOperatingSystem()
0 ignored issues
show
Coding Style introduced by
Method name "UserAgentTest::isOs_delegatesArgumentToOperatingSystem" is not in camel caps format
Loading history...
27
    {
28
        $operatingSystem = $this->createOperatingSystemMock();
29
30
        $operatingSystem->expects($this->once())
31
            ->method('equals')
32
            ->with($this->equalTo(__METHOD__));
33
34
        $userAgent = new UserAgent($operatingSystem, $this->createWebClientMock());
35
        $userAgent->isOs(__METHOD__);
36
    }
37
38
    /**
39
     * @test
40
     */
41
    public function isOs_delegatesReturnValue()
0 ignored issues
show
Coding Style introduced by
Method name "UserAgentTest::isOs_delegatesReturnValue" is not in camel caps format
Loading history...
42
    {
43
        $operatingSystem = $this->createOperatingSystemMock();
44
45
        $operatingSystem->expects($this->once())
46
            ->method('equals')
47
            ->will($this->returnValue(true));
48
49
        $userAgent = new UserAgent($operatingSystem, $this->createWebClientMock());
50
        $this->assertTrue($userAgent->isOs(__METHOD__));
51
    }
52
53
    /**
54
     * @test
55
     */
56
    public function webClient_delegatesReturnValue()
0 ignored issues
show
Coding Style introduced by
Method name "UserAgentTest::webClient_delegatesReturnValue" is not in camel caps format
Loading history...
57
    {
58
        $webClient = $this->createWebClientMock();
59
60
        $webClient->expects($this->once())
61
            ->method('getName')
62
            ->will($this->returnValue(__METHOD__));
63
64
        $userAgent = new UserAgent($this->createOperatingSystemMock(), $webClient);
65
        $this->assertEquals(__METHOD__, $userAgent->webClient());
66
    }
67
68
    /**
69
     * @test
70
     */
71
    public function isWebClient_delegatesArgument()
0 ignored issues
show
Coding Style introduced by
Method name "UserAgentTest::isWebClient_delegatesArgument" is not in camel caps format
Loading history...
72
    {
73
        $webClient = $this->createWebClientMock();
74
75
        $webClient->expects($this->once())
76
            ->method('isNameEquals')
77
            ->with($this->equalTo(__METHOD__));
78
79
        $userAgent = new UserAgent($this->createOperatingSystemMock(), $webClient);
80
        $userAgent->isWebClient(__METHOD__);
81
    }
82
83
    /**
84
     * @test
85
     */
86
    public function isWebClient_delegatesReturnValue()
0 ignored issues
show
Coding Style introduced by
Method name "UserAgentTest::isWebClient_delegatesReturnValue" is not in camel caps format
Loading history...
87
    {
88
        $webClient = $this->createWebClientMock();
89
90
        $webClient->expects($this->once())
91
            ->method('isNameEquals')
92
            ->will($this->returnValue(true));
93
94
        $userAgent = new UserAgent($this->createOperatingSystemMock(), $webClient);
95
        $this->assertTrue($userAgent->isWebClient(__METHOD__));
96
    }
97
98
    /**
99
     * @test
100
     */
101
    public function webClientVersion_delegatesReturnValue()
0 ignored issues
show
Coding Style introduced by
Method name "UserAgentTest::webClientVersion_delegatesReturnValue" is not in camel caps format
Loading history...
102
    {
103
        $webClient = $this->createWebClientMock();
104
105
        $webClient->expects($this->once())
106
            ->method('getVersion')
107
            ->will($this->returnValue(__METHOD__));
108
109
        $userAgent = new UserAgent($this->createOperatingSystemMock(), $webClient);
110
        $this->assertEquals(__METHOD__, $userAgent->webClientVersion());
111
    }
112
113
    /**
114
     * @test
115
     */
116
    public function isWebClientVersion_delegatesArgument()
0 ignored issues
show
Coding Style introduced by
Method name "UserAgentTest::isWebClientVersion_delegatesArgument" is not in camel caps format
Loading history...
117
    {
118
        $webClient = $this->createWebClientMock();
119
120
        $webClient->expects($this->once())
121
            ->method('isVersionEquals')
122
            ->with($this->equalTo(__METHOD__));
123
124
        $userAgent = new UserAgent($this->createOperatingSystemMock(), $webClient);
125
        $userAgent->isWebClientVersion(__METHOD__);
126
    }
127
128
    /**
129
     * @test
130
     */
131
    public function isWebClientVersion_delegatesReturnValue()
0 ignored issues
show
Coding Style introduced by
Method name "UserAgentTest::isWebClientVersion_delegatesReturnValue" is not in camel caps format
Loading history...
132
    {
133
        $webClient = $this->createWebClientMock();
134
135
        $webClient->expects($this->once())
136
            ->method('isVersionEquals')
137
            ->will($this->returnValue(true));
138
139
        $userAgent = new UserAgent($this->createOperatingSystemMock(), $webClient);
140
        $this->assertTrue($userAgent->isWebClientVersion(__METHOD__));
141
    }
142
143
    /**
144
     * @test
145
     */
146
    public function isWebClientVersionBetween_delegatesArguments()
0 ignored issues
show
Coding Style introduced by
Method name "UserAgentTest::isWebClientVersionBetween_delegatesArguments" is not in camel caps format
Loading history...
147
    {
148
        $webClient = $this->createWebClientMock();
149
150
        $webClient->expects($this->once())
151
            ->method('isVersionBetween')
152
            ->with($this->equalTo(__CLASS__), $this->equalTo(__FUNCTION__));
153
154
        $userAgent = new UserAgent($this->createOperatingSystemMock(), $webClient);
155
        $userAgent->isWebClientVersionBetween(__CLASS__, __FUNCTION__);
156
    }
157
158
    /**
159
     * @test
160
     */
161
    public function isWebClientVersionBetween_delegatesReturnValue()
0 ignored issues
show
Coding Style introduced by
Method name "UserAgentTest::isWebClientVersionBetween_delegatesReturnValue" is not in camel caps format
Loading history...
162
    {
163
        $webClient = $this->createWebClientMock();
164
165
        $webClient->expects($this->once())
166
            ->method('isVersionBetween')
167
            ->will($this->returnValue(true));
168
169
        $userAgent = new UserAgent($this->createOperatingSystemMock(), $webClient);
170
        $this->assertTrue($userAgent->isWebClientVersionBetween(__CLASS__, __FUNCTION__));
171
    }
172
173
    /**
174
     * @return PHPUnit_Framework_MockObject_MockObject
175
     */
176
    private function createOperatingSystemMock()
177
    {
178
        return $this->getMockBuilder(OperatingSystem::class)->getMock();
179
    }
180
181
    /**
182
     * @return PHPUnit_Framework_MockObject_MockObject
183
     */
184
    private function createWebClientMock()
185
    {
186
        return $this->getMockBuilder(WebClient::class)->getMock();
187
    }
188
}
189