1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* This file is part of the curl-library package. |
5
|
|
|
* |
6
|
|
|
* (c) 2017 NdC/WBW |
7
|
|
|
* |
8
|
|
|
* For the full copyright and license information, please view the LICENSE |
9
|
|
|
* file that was distributed with this source code. |
10
|
|
|
*/ |
11
|
|
|
|
12
|
|
|
namespace WBW\Library\CURL\Response; |
13
|
|
|
|
14
|
|
|
use PHPUnit_Framework_TestCase; |
15
|
|
|
|
16
|
|
|
/** |
17
|
|
|
* CURL response test. |
18
|
|
|
* |
19
|
|
|
* @author NdC/WBW <https://github.com/webeweb/> |
20
|
|
|
* @package WBW\Library\CURL\Tests\Response |
21
|
|
|
* @final |
22
|
|
|
*/ |
23
|
|
|
final class CURLResponseTest extends PHPUnit_Framework_TestCase { |
24
|
|
|
|
25
|
|
|
/** |
26
|
|
|
* Tests the __constructor() method. |
27
|
|
|
* |
28
|
|
|
* @return void |
29
|
|
|
*/ |
30
|
|
|
public function testConstructor() { |
31
|
|
|
|
32
|
|
|
$obj = new CURLResponse(); |
33
|
|
|
|
34
|
|
|
$this->assertEquals(null, $obj->getRequestBody()); |
35
|
|
|
$this->assertEquals([], $obj->getRequestHeader()); |
36
|
|
|
$this->assertEquals(null, $obj->getRequestURL()); |
37
|
|
|
$this->assertEquals(null, $obj->getResponseBody()); |
38
|
|
|
$this->assertEquals([], $obj->getResponseHeader()); |
39
|
|
|
$this->assertEquals([], $obj->getResponseInfo()); |
40
|
|
|
} |
41
|
|
|
|
42
|
|
|
/** |
43
|
|
|
* Tests the setX() method. |
44
|
|
|
* |
45
|
|
|
* @return void |
46
|
|
|
*/ |
47
|
|
|
public function testSetX() { |
48
|
|
|
|
49
|
|
|
$obj = new CURLResponse(); |
50
|
|
|
|
51
|
|
|
$obj->setRequestBody("requestBody"); |
52
|
|
|
$this->assertEquals("requestBody", $obj->getRequestBody()); |
53
|
|
|
|
54
|
|
|
$obj->setRequestHeader(["requestHeader" => "requestHeader"]); |
55
|
|
|
$this->assertEquals(["requestHeader" => "requestHeader"], $obj->getRequestHeader()); |
56
|
|
|
|
57
|
|
|
$obj->setRequestURL("requestURL"); |
58
|
|
|
$this->assertEquals("requestURL", $obj->getRequestURL()); |
59
|
|
|
|
60
|
|
|
$obj->setResponseBody("responseBody"); |
61
|
|
|
$this->assertEquals("responseBody", $obj->getResponseBody()); |
62
|
|
|
|
63
|
|
|
$obj->setResponseHeader(["responseHeader" => "responseHeader"]); |
64
|
|
|
$this->assertEquals(["responseHeader" => "responseHeader"], $obj->getResponseHeader()); |
65
|
|
|
|
66
|
|
|
$obj->setResponseInfo(["responseInfo" => "responseInfo"]); |
67
|
|
|
$this->assertEquals(["responseInfo" => "responseInfo"], $obj->getResponseInfo()); |
68
|
|
|
} |
69
|
|
|
|
70
|
|
|
} |
71
|
|
|
|