1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace OAuthTest\Unit\Common\Http; |
4
|
|
|
|
5
|
|
|
class AbstractClientTest extends \PHPUnit_Framework_TestCase |
6
|
|
|
{ |
7
|
|
|
/** |
8
|
|
|
* @covers OAuth\Common\Http\Client\AbstractClient::__construct |
9
|
|
|
*/ |
10
|
|
|
public function testConstructCorrectInterface() |
11
|
|
|
{ |
12
|
|
|
$client = $this->getMockForAbstractClass('\\OAuth\\Common\\Http\\Client\\AbstractClient'); |
13
|
|
|
|
14
|
|
|
$this->assertInstanceOf('\\OAuth\\Common\\Http\\Client\\ClientInterface', $client); |
15
|
|
|
} |
16
|
|
|
|
17
|
|
|
/** |
18
|
|
|
* @covers OAuth\Common\Http\Client\AbstractClient::__construct |
19
|
|
|
* @covers OAuth\Common\Http\Client\AbstractClient::setMaxRedirects |
20
|
|
|
*/ |
21
|
|
|
public function testSetMaxRedirects() |
22
|
|
|
{ |
23
|
|
|
$client = $this->getMockForAbstractClass('\\OAuth\\Common\\Http\\Client\\AbstractClient'); |
24
|
|
|
|
25
|
|
|
$this->assertInstanceOf('\\OAuth\\Common\\Http\\Client\\AbstractClient', $client->setMaxRedirects(10)); |
26
|
|
|
$this->assertInstanceOf('\\OAuth\\Common\\Http\\Client\\ClientInterface', $client->setMaxRedirects(10)); |
27
|
|
|
} |
28
|
|
|
|
29
|
|
|
/** |
30
|
|
|
* @covers OAuth\Common\Http\Client\AbstractClient::__construct |
31
|
|
|
* @covers OAuth\Common\Http\Client\AbstractClient::setTimeout |
32
|
|
|
*/ |
33
|
|
|
public function testSetTimeout() |
34
|
|
|
{ |
35
|
|
|
$client = $this->getMockForAbstractClass('\\OAuth\\Common\\Http\\Client\\AbstractClient'); |
36
|
|
|
|
37
|
|
|
$this->assertInstanceOf('\\OAuth\\Common\\Http\\Client\\AbstractClient', $client->setTimeout(25)); |
38
|
|
|
$this->assertInstanceOf('\\OAuth\\Common\\Http\\Client\\ClientInterface', $client->setTimeout(25)); |
39
|
|
|
} |
40
|
|
|
|
41
|
|
|
/** |
42
|
|
|
* @covers OAuth\Common\Http\Client\AbstractClient::__construct |
43
|
|
|
* @covers OAuth\Common\Http\Client\AbstractClient::normalizeHeaders |
44
|
|
|
*/ |
45
|
|
|
public function testNormalizeHeaders() |
46
|
|
|
{ |
47
|
|
|
$client = $this->getMockForAbstractClass('\\OAuth\\Common\\Http\\Client\\AbstractClient'); |
48
|
|
|
|
49
|
|
|
$original = array( |
50
|
|
|
'lowercasekey' => 'lowercasevalue', |
51
|
|
|
'UPPERCASEKEY' => 'UPPERCASEVALUE', |
52
|
|
|
'mIxEdCaSeKey' => 'MiXeDcAsEvAlUe', |
53
|
|
|
'31i71casekey' => '31i71casevalue', |
54
|
|
|
); |
55
|
|
|
|
56
|
|
|
$goal = array( |
57
|
|
|
'lowercasekey' => 'Lowercasekey: lowercasevalue', |
58
|
|
|
'UPPERCASEKEY' => 'Uppercasekey: UPPERCASEVALUE', |
59
|
|
|
'mIxEdCaSeKey' => 'Mixedcasekey: MiXeDcAsEvAlUe', |
60
|
|
|
'31i71casekey' => '31i71casekey: 31i71casevalue', |
61
|
|
|
); |
62
|
|
|
|
63
|
|
|
$client->normalizeHeaders($original); |
64
|
|
|
|
65
|
|
|
$this->assertSame($goal, $original); |
66
|
|
|
} |
67
|
|
|
} |
68
|
|
|
|