SignatureTest   A
last analyzed

Complexity

Total Complexity 10

Size/Duplication

Total Lines 312
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 4

Importance

Changes 0
Metric Value
dl 0
loc 312
c 0
b 0
f 0
wmc 10
lcom 1
cbo 4
rs 10

10 Methods

Rating   Name   Duplication   Size   Complexity  
A testConstructCorrectInterface() 0 6 1
A testSetHashingAlgorithm() 0 6 1
A testSetTokenSecret() 0 6 1
A testGetSignatureBareUri() 0 28 1
A testGetSignatureWithQueryString() 0 28 1
A testGetSignatureWithAuthority() 0 28 1
A testGetSignatureWithBarePathNonExplicitTrailingHostSlash() 0 31 1
A testGetSignatureWithBarePathWithExplicitTrailingHostSlash() 0 31 1
A testGetSignatureNoTokenSecretSet() 0 30 1
A testGetSignatureThrowsExceptionOnUnsupportedAlgo() 0 32 1
1
<?php
2
3
namespace OAuthTest\Unit\OAuth1\Signature;
4
5
use OAuth\OAuth1\Signature\Signature;
6
use PHPUnit\Framework\TestCase;
7
8
class SignatureTest extends TestCase
9
{
10
    /**
11
     * @covers \OAuth\OAuth1\Signature\Signature::__construct
12
     */
13
    public function testConstructCorrectInterface(): void
14
    {
15
        $signature = new Signature($this->createMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'));
0 ignored issues
show
Documentation introduced by
$this->createMock('\\OAu...\CredentialsInterface') is of type object<PHPUnit\Framework\MockObject\MockObject>, but the function expects a object<OAuth\Common\Cons...r\CredentialsInterface>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
16
17
        self::assertInstanceOf('\\OAuth\\OAuth1\\Signature\\SignatureInterface', $signature);
18
    }
19
20
    /**
21
     * @covers \OAuth\OAuth1\Signature\Signature::__construct
22
     * @covers \OAuth\OAuth1\Signature\Signature::setHashingAlgorithm
23
     */
24
    public function testSetHashingAlgorithm(): void
25
    {
26
        $signature = new Signature($this->createMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'));
0 ignored issues
show
Documentation introduced by
$this->createMock('\\OAu...\CredentialsInterface') is of type object<PHPUnit\Framework\MockObject\MockObject>, but the function expects a object<OAuth\Common\Cons...r\CredentialsInterface>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
27
28
        self::assertNull($signature->setHashingAlgorithm('foo'));
29
    }
30
31
    /**
32
     * @covers \OAuth\OAuth1\Signature\Signature::__construct
33
     * @covers \OAuth\OAuth1\Signature\Signature::setTokenSecret
34
     */
35
    public function testSetTokenSecret(): void
36
    {
37
        $signature = new Signature($this->createMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'));
0 ignored issues
show
Documentation introduced by
$this->createMock('\\OAu...\CredentialsInterface') is of type object<PHPUnit\Framework\MockObject\MockObject>, but the function expects a object<OAuth\Common\Cons...r\CredentialsInterface>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
38
39
        self::assertNull($signature->setTokenSecret('foo'));
40
    }
41
42
    /**
43
     * @covers \OAuth\OAuth1\Signature\Signature::__construct
44
     * @covers \OAuth\OAuth1\Signature\Signature::buildSignatureDataString
45
     * @covers \OAuth\OAuth1\Signature\Signature::getSignature
46
     * @covers \OAuth\OAuth1\Signature\Signature::getSigningKey
47
     * @covers \OAuth\OAuth1\Signature\Signature::hash
48
     * @covers \OAuth\OAuth1\Signature\Signature::setHashingAlgorithm
49
     * @covers \OAuth\OAuth1\Signature\Signature::setTokenSecret
50
     */
51
    public function testGetSignatureBareUri(): void
52
    {
53
        $credentials = $this->createMock('\\OAuth\\Common\\Consumer\\CredentialsInterface');
54
        $credentials->expects(self::any())
55
            ->method('getConsumerSecret')
56
            ->willReturn('foo');
57
58
        $signature = new Signature($credentials);
0 ignored issues
show
Documentation introduced by
$credentials is of type object<PHPUnit\Framework\MockObject\MockObject>, but the function expects a object<OAuth\Common\Cons...r\CredentialsInterface>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
59
60
        $signature->setHashingAlgorithm('HMAC-SHA1');
61
        $signature->setTokenSecret('foo');
62
63
        $uri = $this->createMock('\\OAuth\\Common\\Http\\Uri\\UriInterface');
64
        $uri->expects(self::any())
65
            ->method('getQuery')
66
            ->willReturn('');
67
        $uri->expects(self::any())
68
            ->method('getScheme')
69
            ->willReturn('http');
70
        $uri->expects(self::any())
71
            ->method('getRawAuthority')
72
            ->willReturn('');
73
        $uri->expects(self::any())
74
            ->method('getPath')
75
            ->willReturn('/foo');
76
77
        self::assertSame('uoCpiII/Lg/cPiF0XrU2pj4eGFQ=', $signature->getSignature($uri, ['pee' => 'haa']));
0 ignored issues
show
Documentation introduced by
$uri is of type object<PHPUnit\Framework\MockObject\MockObject>, but the function expects a object<OAuth\Common\Http\Uri\UriInterface>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
78
    }
79
80
    /**
81
     * @covers \OAuth\OAuth1\Signature\Signature::__construct
82
     * @covers \OAuth\OAuth1\Signature\Signature::buildSignatureDataString
83
     * @covers \OAuth\OAuth1\Signature\Signature::getSignature
84
     * @covers \OAuth\OAuth1\Signature\Signature::getSigningKey
85
     * @covers \OAuth\OAuth1\Signature\Signature::hash
86
     * @covers \OAuth\OAuth1\Signature\Signature::setHashingAlgorithm
87
     * @covers \OAuth\OAuth1\Signature\Signature::setTokenSecret
88
     */
89
    public function testGetSignatureWithQueryString(): void
90
    {
91
        $credentials = $this->createMock('\\OAuth\\Common\\Consumer\\CredentialsInterface');
92
        $credentials->expects(self::any())
93
            ->method('getConsumerSecret')
94
            ->willReturn('foo');
95
96
        $signature = new Signature($credentials);
0 ignored issues
show
Documentation introduced by
$credentials is of type object<PHPUnit\Framework\MockObject\MockObject>, but the function expects a object<OAuth\Common\Cons...r\CredentialsInterface>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
97
98
        $signature->setHashingAlgorithm('HMAC-SHA1');
99
        $signature->setTokenSecret('foo');
100
101
        $uri = $this->createMock('\\OAuth\\Common\\Http\\Uri\\UriInterface');
102
        $uri->expects(self::any())
103
            ->method('getQuery')
104
            ->willReturn('param1=value1');
105
        $uri->expects(self::any())
106
            ->method('getScheme')
107
            ->willReturn('http');
108
        $uri->expects(self::any())
109
            ->method('getRawAuthority')
110
            ->willReturn('');
111
        $uri->expects(self::any())
112
            ->method('getPath')
113
            ->willReturn('/foo');
114
115
        self::assertSame('LxtD+WjJBRppIUvEI79iQ7I0hSo=', $signature->getSignature($uri, ['pee' => 'haa']));
0 ignored issues
show
Documentation introduced by
$uri is of type object<PHPUnit\Framework\MockObject\MockObject>, but the function expects a object<OAuth\Common\Http\Uri\UriInterface>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
116
    }
117
118
    /**
119
     * @covers \OAuth\OAuth1\Signature\Signature::__construct
120
     * @covers \OAuth\OAuth1\Signature\Signature::buildSignatureDataString
121
     * @covers \OAuth\OAuth1\Signature\Signature::getSignature
122
     * @covers \OAuth\OAuth1\Signature\Signature::getSigningKey
123
     * @covers \OAuth\OAuth1\Signature\Signature::hash
124
     * @covers \OAuth\OAuth1\Signature\Signature::setHashingAlgorithm
125
     * @covers \OAuth\OAuth1\Signature\Signature::setTokenSecret
126
     */
127
    public function testGetSignatureWithAuthority(): void
128
    {
129
        $credentials = $this->createMock('\\OAuth\\Common\\Consumer\\CredentialsInterface');
130
        $credentials->expects(self::any())
131
            ->method('getConsumerSecret')
132
            ->willReturn('foo');
133
134
        $signature = new Signature($credentials);
0 ignored issues
show
Documentation introduced by
$credentials is of type object<PHPUnit\Framework\MockObject\MockObject>, but the function expects a object<OAuth\Common\Cons...r\CredentialsInterface>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
135
136
        $signature->setHashingAlgorithm('HMAC-SHA1');
137
        $signature->setTokenSecret('foo');
138
139
        $uri = $this->createMock('\\OAuth\\Common\\Http\\Uri\\UriInterface');
140
        $uri->expects(self::any())
141
            ->method('getQuery')
142
            ->willReturn('param1=value1');
143
        $uri->expects(self::any())
144
            ->method('getScheme')
145
            ->willReturn('http');
146
        $uri->expects(self::any())
147
            ->method('getRawAuthority')
148
            ->willReturn('peehaa:pass');
149
        $uri->expects(self::any())
150
            ->method('getPath')
151
            ->willReturn('/foo');
152
153
        self::assertSame('MHvkRndIntLrxiPkjkiCNsMEqv4=', $signature->getSignature($uri, ['pee' => 'haa']));
0 ignored issues
show
Documentation introduced by
$uri is of type object<PHPUnit\Framework\MockObject\MockObject>, but the function expects a object<OAuth\Common\Http\Uri\UriInterface>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
154
    }
155
156
    /**
157
     * @covers \OAuth\OAuth1\Signature\Signature::__construct
158
     * @covers \OAuth\OAuth1\Signature\Signature::buildSignatureDataString
159
     * @covers \OAuth\OAuth1\Signature\Signature::getSignature
160
     * @covers \OAuth\OAuth1\Signature\Signature::getSigningKey
161
     * @covers \OAuth\OAuth1\Signature\Signature::hash
162
     * @covers \OAuth\OAuth1\Signature\Signature::setHashingAlgorithm
163
     * @covers \OAuth\OAuth1\Signature\Signature::setTokenSecret
164
     */
165
    public function testGetSignatureWithBarePathNonExplicitTrailingHostSlash(): void
166
    {
167
        $credentials = $this->createMock('\\OAuth\\Common\\Consumer\\CredentialsInterface');
168
        $credentials->expects(self::any())
169
            ->method('getConsumerSecret')
170
            ->willReturn('foo');
171
172
        $signature = new Signature($credentials);
0 ignored issues
show
Documentation introduced by
$credentials is of type object<PHPUnit\Framework\MockObject\MockObject>, but the function expects a object<OAuth\Common\Cons...r\CredentialsInterface>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
173
174
        $signature->setHashingAlgorithm('HMAC-SHA1');
175
        $signature->setTokenSecret('foo');
176
177
        $uri = $this->createMock('\\OAuth\\Common\\Http\\Uri\\UriInterface');
178
        $uri->expects(self::any())
179
            ->method('getQuery')
180
            ->willReturn('param1=value1');
181
        $uri->expects(self::any())
182
            ->method('getScheme')
183
            ->willReturn('http');
184
        $uri->expects(self::any())
185
            ->method('getRawAuthority')
186
            ->willReturn('peehaa:pass');
187
        $uri->expects(self::any())
188
            ->method('getPath')
189
            ->willReturn('/');
190
        $uri->expects(self::any())
191
            ->method('hasExplicitTrailingHostSlash')
192
            ->willReturn(false);
193
194
        self::assertSame('iFELDoiI5Oj9ixB3kHzoPvBpq0w=', $signature->getSignature($uri, ['pee' => 'haa']));
0 ignored issues
show
Documentation introduced by
$uri is of type object<PHPUnit\Framework\MockObject\MockObject>, but the function expects a object<OAuth\Common\Http\Uri\UriInterface>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
195
    }
196
197
    /**
198
     * @covers \OAuth\OAuth1\Signature\Signature::__construct
199
     * @covers \OAuth\OAuth1\Signature\Signature::buildSignatureDataString
200
     * @covers \OAuth\OAuth1\Signature\Signature::getSignature
201
     * @covers \OAuth\OAuth1\Signature\Signature::getSigningKey
202
     * @covers \OAuth\OAuth1\Signature\Signature::hash
203
     * @covers \OAuth\OAuth1\Signature\Signature::setHashingAlgorithm
204
     * @covers \OAuth\OAuth1\Signature\Signature::setTokenSecret
205
     */
206
    public function testGetSignatureWithBarePathWithExplicitTrailingHostSlash(): void
207
    {
208
        $credentials = $this->createMock('\\OAuth\\Common\\Consumer\\CredentialsInterface');
209
        $credentials->expects(self::any())
210
            ->method('getConsumerSecret')
211
            ->willReturn('foo');
212
213
        $signature = new Signature($credentials);
0 ignored issues
show
Documentation introduced by
$credentials is of type object<PHPUnit\Framework\MockObject\MockObject>, but the function expects a object<OAuth\Common\Cons...r\CredentialsInterface>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
214
215
        $signature->setHashingAlgorithm('HMAC-SHA1');
216
        $signature->setTokenSecret('foo');
217
218
        $uri = $this->createMock('\\OAuth\\Common\\Http\\Uri\\UriInterface');
219
        $uri->expects(self::any())
220
            ->method('getQuery')
221
            ->willReturn('param1=value1');
222
        $uri->expects(self::any())
223
            ->method('getScheme')
224
            ->willReturn('http');
225
        $uri->expects(self::any())
226
            ->method('getRawAuthority')
227
            ->willReturn('peehaa:pass');
228
        $uri->expects(self::any())
229
            ->method('getPath')
230
            ->willReturn('/');
231
        $uri->expects(self::any())
232
            ->method('hasExplicitTrailingHostSlash')
233
            ->willReturn(true);
234
235
        self::assertSame('IEhUsArSTLvbQ3QYr0zzn+Rxpjg=', $signature->getSignature($uri, ['pee' => 'haa']));
0 ignored issues
show
Documentation introduced by
$uri is of type object<PHPUnit\Framework\MockObject\MockObject>, but the function expects a object<OAuth\Common\Http\Uri\UriInterface>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
236
    }
237
238
    /**
239
     * @covers \OAuth\OAuth1\Signature\Signature::__construct
240
     * @covers \OAuth\OAuth1\Signature\Signature::buildSignatureDataString
241
     * @covers \OAuth\OAuth1\Signature\Signature::getSignature
242
     * @covers \OAuth\OAuth1\Signature\Signature::getSigningKey
243
     * @covers \OAuth\OAuth1\Signature\Signature::hash
244
     * @covers \OAuth\OAuth1\Signature\Signature::setHashingAlgorithm
245
     * @covers \OAuth\OAuth1\Signature\Signature::setTokenSecret
246
     */
247
    public function testGetSignatureNoTokenSecretSet(): void
248
    {
249
        $credentials = $this->createMock('\\OAuth\\Common\\Consumer\\CredentialsInterface');
250
        $credentials->expects(self::any())
251
            ->method('getConsumerSecret')
252
            ->willReturn('foo');
253
254
        $signature = new Signature($credentials);
0 ignored issues
show
Documentation introduced by
$credentials is of type object<PHPUnit\Framework\MockObject\MockObject>, but the function expects a object<OAuth\Common\Cons...r\CredentialsInterface>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
255
256
        $signature->setHashingAlgorithm('HMAC-SHA1');
257
258
        $uri = $this->createMock('\\OAuth\\Common\\Http\\Uri\\UriInterface');
259
        $uri->expects(self::any())
260
            ->method('getQuery')
261
            ->willReturn('param1=value1');
262
        $uri->expects(self::any())
263
            ->method('getScheme')
264
            ->willReturn('http');
265
        $uri->expects(self::any())
266
            ->method('getRawAuthority')
267
            ->willReturn('peehaa:pass');
268
        $uri->expects(self::any())
269
            ->method('getPath')
270
            ->willReturn('/');
271
        $uri->expects(self::any())
272
            ->method('hasExplicitTrailingHostSlash')
273
            ->willReturn(true);
274
275
        self::assertSame('YMHF7FYmLq7wzGnnHWYtd1VoBBE=', $signature->getSignature($uri, ['pee' => 'haa']));
0 ignored issues
show
Documentation introduced by
$uri is of type object<PHPUnit\Framework\MockObject\MockObject>, but the function expects a object<OAuth\Common\Http\Uri\UriInterface>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
276
    }
277
278
    /**
279
     * @covers \OAuth\OAuth1\Signature\Signature::__construct
280
     * @covers \OAuth\OAuth1\Signature\Signature::buildSignatureDataString
281
     * @covers \OAuth\OAuth1\Signature\Signature::getSignature
282
     * @covers \OAuth\OAuth1\Signature\Signature::getSigningKey
283
     * @covers \OAuth\OAuth1\Signature\Signature::hash
284
     * @covers \OAuth\OAuth1\Signature\Signature::setHashingAlgorithm
285
     * @covers \OAuth\OAuth1\Signature\Signature::setTokenSecret
286
     */
287
    public function testGetSignatureThrowsExceptionOnUnsupportedAlgo(): void
288
    {
289
        $this->expectException('\\OAuth\\OAuth1\\Signature\\Exception\\UnsupportedHashAlgorithmException');
290
291
        $credentials = $this->createMock('\\OAuth\\Common\\Consumer\\CredentialsInterface');
292
        $credentials->expects(self::any())
293
            ->method('getConsumerSecret')
294
            ->willReturn('foo');
295
296
        $signature = new Signature($credentials);
0 ignored issues
show
Documentation introduced by
$credentials is of type object<PHPUnit\Framework\MockObject\MockObject>, but the function expects a object<OAuth\Common\Cons...r\CredentialsInterface>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
297
298
        $signature->setHashingAlgorithm('UnsupportedAlgo');
299
300
        $uri = $this->createMock('\\OAuth\\Common\\Http\\Uri\\UriInterface');
301
        $uri->expects(self::any())
302
            ->method('getQuery')
303
            ->willReturn('param1=value1');
304
        $uri->expects(self::any())
305
            ->method('getScheme')
306
            ->willReturn('http');
307
        $uri->expects(self::any())
308
            ->method('getRawAuthority')
309
            ->willReturn('peehaa:pass');
310
        $uri->expects(self::any())
311
            ->method('getPath')
312
            ->willReturn('/');
313
        $uri->expects(self::any())
314
            ->method('hasExplicitTrailingHostSlash')
315
            ->willReturn(true);
316
317
        $signature->getSignature($uri, ['pee' => 'haa']);
0 ignored issues
show
Documentation introduced by
$uri is of type object<PHPUnit\Framework\MockObject\MockObject>, but the function expects a object<OAuth\Common\Http\Uri\UriInterface>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
318
    }
319
}
320