|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace OAuthTest\Unit\Common\Http; |
|
4
|
|
|
|
|
5
|
|
|
use PHPUnit\Framework\TestCase; |
|
6
|
|
|
|
|
7
|
|
|
class AbstractClientTest extends TestCase |
|
8
|
|
|
{ |
|
9
|
|
|
/** |
|
10
|
|
|
* @covers \OAuth\Common\Http\Client\AbstractClient::__construct |
|
11
|
|
|
*/ |
|
12
|
|
|
public function testConstructCorrectInterface(): void |
|
13
|
|
|
{ |
|
14
|
|
|
$client = $this->getMockForAbstractClass('\\OAuth\\Common\\Http\\Client\\AbstractClient'); |
|
15
|
|
|
|
|
16
|
|
|
self::assertInstanceOf('\\OAuth\\Common\\Http\\Client\\ClientInterface', $client); |
|
17
|
|
|
} |
|
18
|
|
|
|
|
19
|
|
|
/** |
|
20
|
|
|
* @covers \OAuth\Common\Http\Client\AbstractClient::__construct |
|
21
|
|
|
* @covers \OAuth\Common\Http\Client\AbstractClient::setMaxRedirects |
|
22
|
|
|
*/ |
|
23
|
|
|
public function testSetMaxRedirects(): void |
|
24
|
|
|
{ |
|
25
|
|
|
$client = $this->getMockForAbstractClass('\\OAuth\\Common\\Http\\Client\\AbstractClient'); |
|
26
|
|
|
|
|
27
|
|
|
self::assertInstanceOf('\\OAuth\\Common\\Http\\Client\\AbstractClient', $client->setMaxRedirects(10)); |
|
|
|
|
|
|
28
|
|
|
self::assertInstanceOf('\\OAuth\\Common\\Http\\Client\\ClientInterface', $client->setMaxRedirects(10)); |
|
|
|
|
|
|
29
|
|
|
} |
|
30
|
|
|
|
|
31
|
|
|
/** |
|
32
|
|
|
* @covers \OAuth\Common\Http\Client\AbstractClient::__construct |
|
33
|
|
|
* @covers \OAuth\Common\Http\Client\AbstractClient::setTimeout |
|
34
|
|
|
*/ |
|
35
|
|
|
public function testSetTimeout(): void |
|
36
|
|
|
{ |
|
37
|
|
|
$client = $this->getMockForAbstractClass('\\OAuth\\Common\\Http\\Client\\AbstractClient'); |
|
38
|
|
|
|
|
39
|
|
|
self::assertInstanceOf('\\OAuth\\Common\\Http\\Client\\AbstractClient', $client->setTimeout(25)); |
|
|
|
|
|
|
40
|
|
|
self::assertInstanceOf('\\OAuth\\Common\\Http\\Client\\ClientInterface', $client->setTimeout(25)); |
|
|
|
|
|
|
41
|
|
|
} |
|
42
|
|
|
|
|
43
|
|
|
/** |
|
44
|
|
|
* @covers \OAuth\Common\Http\Client\AbstractClient::__construct |
|
45
|
|
|
* @covers \OAuth\Common\Http\Client\AbstractClient::normalizeHeaders |
|
46
|
|
|
*/ |
|
47
|
|
|
public function testNormalizeHeaders(): void |
|
48
|
|
|
{ |
|
49
|
|
|
$client = $this->getMockForAbstractClass('\\OAuth\\Common\\Http\\Client\\AbstractClient'); |
|
50
|
|
|
|
|
51
|
|
|
$original = [ |
|
52
|
|
|
'lowercasekey' => 'lowercasevalue', |
|
53
|
|
|
'UPPERCASEKEY' => 'UPPERCASEVALUE', |
|
54
|
|
|
'mIxEdCaSeKey' => 'MiXeDcAsEvAlUe', |
|
55
|
|
|
'31i71casekey' => '31i71casevalue', |
|
56
|
|
|
]; |
|
57
|
|
|
|
|
58
|
|
|
$goal = [ |
|
59
|
|
|
'lowercasekey' => 'Lowercasekey: lowercasevalue', |
|
60
|
|
|
'UPPERCASEKEY' => 'Uppercasekey: UPPERCASEVALUE', |
|
61
|
|
|
'mIxEdCaSeKey' => 'Mixedcasekey: MiXeDcAsEvAlUe', |
|
62
|
|
|
'31i71casekey' => '31i71casekey: 31i71casevalue', |
|
63
|
|
|
]; |
|
64
|
|
|
|
|
65
|
|
|
$client->normalizeHeaders($original); |
|
|
|
|
|
|
66
|
|
|
|
|
67
|
|
|
self::assertSame($goal, $original); |
|
68
|
|
|
} |
|
69
|
|
|
} |
|
70
|
|
|
|
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.
This is most likely a typographical error or the method has been renamed.