|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/** |
|
4
|
|
|
* This file is part of the core-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\Core\Tests\HTTP; |
|
13
|
|
|
|
|
14
|
|
|
use PHPUnit_Framework_TestCase; |
|
15
|
|
|
use WBW\Library\Core\HTTP\HTTPCodeInterface; |
|
16
|
|
|
|
|
17
|
|
|
/** |
|
18
|
|
|
* HTTP code interface test. |
|
19
|
|
|
* |
|
20
|
|
|
* @author NdC/WBW <https://github.com/webeweb/> |
|
21
|
|
|
* @package WBW\Library\Core\Tests\HTTP |
|
22
|
|
|
* @final |
|
23
|
|
|
*/ |
|
24
|
|
|
final class HTTPCodeInterfaceTest extends PHPUnit_Framework_TestCase { |
|
25
|
|
|
|
|
26
|
|
|
/** |
|
27
|
|
|
* Tests the __construct() method. |
|
28
|
|
|
* |
|
29
|
|
|
* @return void |
|
30
|
|
|
*/ |
|
31
|
|
|
public function testConstruct() { |
|
32
|
|
|
|
|
33
|
|
|
$this->assertEquals(100, HTTPCodeInterface::CODE_CONTINUE); |
|
34
|
|
|
$this->assertEquals(101, HTTPCodeInterface::CODE_SWITCHING_PROTOCOLS); |
|
35
|
|
|
$this->assertEquals(102, HTTPCodeInterface::CODE_PROCESSING); |
|
36
|
|
|
$this->assertEquals(200, HTTPCodeInterface::CODE_OK); |
|
37
|
|
|
$this->assertEquals(201, HTTPCodeInterface::CODE_CREATED); |
|
38
|
|
|
$this->assertEquals(202, HTTPCodeInterface::CODE_ACCEPTED); |
|
39
|
|
|
$this->assertEquals(203, HTTPCodeInterface::CODE_NON_AUTHORITATIVE_INFORMATION); |
|
40
|
|
|
$this->assertEquals(204, HTTPCodeInterface::CODE_NO_CONTENT); |
|
41
|
|
|
$this->assertEquals(205, HTTPCodeInterface::CODE_RESET_CONTENT); |
|
42
|
|
|
$this->assertEquals(206, HTTPCodeInterface::CODE_PARTIAL_CONTENT); |
|
43
|
|
|
$this->assertEquals(207, HTTPCodeInterface::CODE_MULTI_STATUS); |
|
44
|
|
|
$this->assertEquals(208, HTTPCodeInterface::CODE_ALREADY_REPORTED); |
|
45
|
|
|
$this->assertEquals(210, HTTPCodeInterface::CODE_CONTENT_DIFFERENT); |
|
46
|
|
|
$this->assertEquals(226, HTTPCodeInterface::CODE_IM_USED); |
|
47
|
|
|
$this->assertEquals(300, HTTPCodeInterface::CODE_MULTIPLE_CHOICES); |
|
48
|
|
|
$this->assertEquals(301, HTTPCodeInterface::CODE_MOVED_PERMANENTLY); |
|
49
|
|
|
$this->assertEquals(302, HTTPCodeInterface::CODE_MOVED_TEMPORARILY); |
|
50
|
|
|
$this->assertEquals(303, HTTPCodeInterface::CODE_SEE_OTHER); |
|
51
|
|
|
$this->assertEquals(304, HTTPCodeInterface::CODE_NOT_MODIFIED); |
|
52
|
|
|
$this->assertEquals(305, HTTPCodeInterface::CODE_USE_PROXY); |
|
53
|
|
|
$this->assertEquals(306, HTTPCodeInterface::CODE_SWITCH_PROXY); |
|
54
|
|
|
$this->assertEquals(307, HTTPCodeInterface::CODE_TEMPORARY_REDIRECT); |
|
55
|
|
|
$this->assertEquals(308, HTTPCodeInterface::CODE_PERMANENT_REDIRECT); |
|
56
|
|
|
$this->assertEquals(310, HTTPCodeInterface::CODE_TOO_MANY_REDIRECTS); |
|
57
|
|
|
$this->assertEquals(400, HTTPCodeInterface::CODE_BAD_REQUEST); |
|
58
|
|
|
$this->assertEquals(401, HTTPCodeInterface::CODE_UNAUTHORIZED); |
|
59
|
|
|
$this->assertEquals(402, HTTPCodeInterface::CODE_PAYMENT_REQUIRED); |
|
60
|
|
|
$this->assertEquals(403, HTTPCodeInterface::CODE_FORBIDDEN); |
|
61
|
|
|
$this->assertEquals(404, HTTPCodeInterface::CODE_NOT_FOUND); |
|
62
|
|
|
$this->assertEquals(405, HTTPCodeInterface::CODE_METHOD_NOT_ALLOWED); |
|
63
|
|
|
$this->assertEquals(406, HTTPCodeInterface::CODE_NOT_ACCEPTABLE); |
|
64
|
|
|
$this->assertEquals(407, HTTPCodeInterface::CODE_PROXY_AUTHENTICATION_REQUIRED); |
|
65
|
|
|
$this->assertEquals(408, HTTPCodeInterface::CODE_REQUEST_TIME_OUT); |
|
66
|
|
|
$this->assertEquals(409, HTTPCodeInterface::CODE_CONFLICT); |
|
67
|
|
|
$this->assertEquals(410, HTTPCodeInterface::CODE_GONE); |
|
68
|
|
|
$this->assertEquals(411, HTTPCodeInterface::CODE_LENGTH_REQUIRED); |
|
69
|
|
|
$this->assertEquals(412, HTTPCodeInterface::CODE_PRECONDITION_FAILED); |
|
70
|
|
|
$this->assertEquals(413, HTTPCodeInterface::CODE_REQUEST_ENTITY_TOO_LARGE); |
|
71
|
|
|
$this->assertEquals(414, HTTPCodeInterface::CODE_REQUEST_URI_TOO_LONG); |
|
72
|
|
|
$this->assertEquals(415, HTTPCodeInterface::CODE_UNSUPPORTED_MEDIA_TYPE); |
|
73
|
|
|
$this->assertEquals(416, HTTPCodeInterface::CODE_REQUESTED_RANGE_UNSATISFIABLE); |
|
74
|
|
|
$this->assertEquals(417, HTTPCodeInterface::CODE_EXPECTATION_FAILED); |
|
75
|
|
|
$this->assertEquals(418, HTTPCodeInterface::CODE_IM_A_TEAPOT); |
|
76
|
|
|
$this->assertEquals(421, HTTPCodeInterface::CODE_BAD_MAPPING_MISDIRECTED_REQUEST); |
|
77
|
|
|
$this->assertEquals(422, HTTPCodeInterface::CODE_UNPROCESSABLE_ENTITY); |
|
78
|
|
|
$this->assertEquals(423, HTTPCodeInterface::CODE_LOCKED); |
|
79
|
|
|
$this->assertEquals(424, HTTPCodeInterface::CODE_METHOD_FAILURE); |
|
80
|
|
|
$this->assertEquals(425, HTTPCodeInterface::CODE_UNORDERED_COLLECTION); |
|
81
|
|
|
$this->assertEquals(426, HTTPCodeInterface::CODE_UPGRADE_REQUIRED); |
|
82
|
|
|
$this->assertEquals(428, HTTPCodeInterface::CODE_PRECONDITION_REQUIRED); |
|
83
|
|
|
$this->assertEquals(429, HTTPCodeInterface::CODE_TOO_MANY_REQUESTS); |
|
84
|
|
|
$this->assertEquals(431, HTTPCodeInterface::CODE_REQUEST_HEADER_FIELDS_TOO_LARGE); |
|
85
|
|
|
$this->assertEquals(449, HTTPCodeInterface::CODE_RETRY_WITH); |
|
86
|
|
|
$this->assertEquals(450, HTTPCodeInterface::CODE_BLOCKED_BY_WINDOWS_PARENTAL_CONTROLS); |
|
87
|
|
|
$this->assertEquals(451, HTTPCodeInterface::CODE_UNAVAILABLE_FOR_LEGAL_REASONS); |
|
88
|
|
|
$this->assertEquals(456, HTTPCodeInterface::CODE_UNRECOVERABLE_ERROR); |
|
89
|
|
|
$this->assertEquals(444, HTTPCodeInterface::CODE_NO_RESPONSE); |
|
90
|
|
|
$this->assertEquals(495, HTTPCodeInterface::CODE_SSL_CERTIFICATE_ERROR); |
|
91
|
|
|
$this->assertEquals(496, HTTPCodeInterface::CODE_SSL_CERTIFICATE_REQUIRED); |
|
92
|
|
|
$this->assertEquals(497, HTTPCodeInterface::CODE_HTTP_REQUEST_SENT_TO_HTTPS_PORT); |
|
93
|
|
|
$this->assertEquals(499, HTTPCodeInterface::CODE_CLIENT_CLOSED_REQUEST); |
|
94
|
|
|
$this->assertEquals(500, HTTPCodeInterface::CODE_INTERNAL_SERVER_ERROR); |
|
95
|
|
|
$this->assertEquals(501, HTTPCodeInterface::CODE_NOT_IMPLEMENTED); |
|
96
|
|
|
$this->assertEquals(502, HTTPCodeInterface::CODE_BAD_GATEWAY_OU_PROXY_ERROR); |
|
97
|
|
|
$this->assertEquals(503, HTTPCodeInterface::CODE_SERVICE_UNAVAILABLE); |
|
98
|
|
|
$this->assertEquals(504, HTTPCodeInterface::CODE_GATEWAY_TIME_OUT); |
|
99
|
|
|
$this->assertEquals(505, HTTPCodeInterface::CODE_HTTP_VERSION_NOT_SUPPORTED); |
|
100
|
|
|
$this->assertEquals(506, HTTPCodeInterface::CODE_VARIANT_ALSO_NEGOTIATES); |
|
101
|
|
|
$this->assertEquals(507, HTTPCodeInterface::CODE_INSUFFICIENT_STORAGE); |
|
102
|
|
|
$this->assertEquals(508, HTTPCodeInterface::CODE_LOOP_DETECTED); |
|
103
|
|
|
$this->assertEquals(509, HTTPCodeInterface::CODE_BANDWIDTH_LIMIT_EXCEEDED); |
|
104
|
|
|
$this->assertEquals(510, HTTPCodeInterface::CODE_NOT_EXTENDED); |
|
105
|
|
|
$this->assertEquals(511, HTTPCodeInterface::CODE_NETWORK_AUTHENTICATION_REQUIRED); |
|
106
|
|
|
$this->assertEquals(520, HTTPCodeInterface::CODE_UNKNOWN_ERROR); |
|
107
|
|
|
$this->assertEquals(521, HTTPCodeInterface::CODE_WEB_SERVER_IS_DOWN); |
|
108
|
|
|
$this->assertEquals(522, HTTPCodeInterface::CODE_CONNECTION_TIMED_OUT); |
|
109
|
|
|
$this->assertEquals(523, HTTPCodeInterface::CODE_ORIGIN_IS_UNREACHABLE); |
|
110
|
|
|
$this->assertEquals(524, HTTPCodeInterface::CODE_A_TIMEOUT_OCCURRED); |
|
111
|
|
|
$this->assertEquals(525, HTTPCodeInterface::CODE_SSL_HANDSHAKE_FAILED); |
|
112
|
|
|
$this->assertEquals(526, HTTPCodeInterface::CODE_INVALID_SSL_CERTIFICATE); |
|
113
|
|
|
$this->assertEquals(527, HTTPCodeInterface::CODE_RAILGUN_ERROR); |
|
114
|
|
|
} |
|
115
|
|
|
|
|
116
|
|
|
} |
|
117
|
|
|
|