1 | <?php |
||
11 | class CIPHPUnitTestRequest |
||
|
|||
12 | { |
||
13 | /** |
||
14 | * @var TestCase |
||
15 | */ |
||
16 | protected $testCase; |
||
17 | |||
18 | /** |
||
19 | * @var CIPHPUnitTestSuperGlobal |
||
20 | */ |
||
21 | protected $superGlobal; |
||
22 | |||
23 | /** |
||
24 | * @var CIPHPUnitTestRouter |
||
25 | */ |
||
26 | protected $router; |
||
27 | |||
28 | /** |
||
29 | * @var callable[] callable called post controller constructor |
||
30 | */ |
||
31 | protected $callables = []; |
||
32 | |||
33 | /** |
||
34 | * @var callable[] callable called pre controller constructor |
||
35 | */ |
||
36 | protected $callablePreConstructors = []; |
||
37 | |||
38 | protected $enableHooks = false; |
||
39 | |||
40 | /** |
||
41 | * @var CI_Hooks |
||
42 | */ |
||
43 | protected $hooks; |
||
44 | |||
45 | public function __construct(TestCase $testCase) |
||
51 | |||
52 | /** |
||
53 | * Set HTTP request header |
||
54 | * |
||
55 | * @param string $name header name |
||
56 | * @param string $value value |
||
57 | */ |
||
58 | public function setHeader($name, $value) |
||
62 | |||
63 | /** |
||
64 | * Set $_FILES |
||
65 | * |
||
66 | * @param array $files |
||
67 | */ |
||
68 | public function setFiles(array $files) |
||
72 | |||
73 | /** |
||
74 | * Set (and Reset) callable |
||
75 | * |
||
76 | * @param callable $callable function to run after controller instantiation |
||
77 | */ |
||
78 | public function setCallable(callable $callable) |
||
83 | |||
84 | /** |
||
85 | * Add callable |
||
86 | * |
||
87 | * @param callable $callable function to run after controller instantiation |
||
88 | */ |
||
89 | public function addCallable(callable $callable) |
||
93 | |||
94 | /** |
||
95 | * Set (and Reset) callable pre constructor |
||
96 | * |
||
97 | * @param callable $callable function to run before controller instantiation |
||
98 | */ |
||
99 | public function setCallablePreConstructor(callable $callable) |
||
104 | |||
105 | /** |
||
106 | * Add callable pre constructor |
||
107 | * |
||
108 | * @param callable $callable function to run before controller instantiation |
||
109 | */ |
||
110 | public function addCallablePreConstructor(callable $callable) |
||
114 | |||
115 | /** |
||
116 | * Enable Hooks for Controllres |
||
117 | * This enables only pre_controller, post_controller_constructor, post_controller |
||
118 | */ |
||
119 | public function enableHooks() |
||
124 | |||
125 | /** |
||
126 | * Request to Controller |
||
127 | * |
||
128 | * @param string $http_method HTTP method |
||
129 | * @param array|string $argv array of controller,method,arg|uri |
||
130 | * @param array|string $params POST params/GET params|raw_input_stream |
||
131 | */ |
||
132 | public function request($http_method, $argv, $params = []) |
||
202 | |||
203 | protected function processError(Exception $e) |
||
207 | |||
208 | /** |
||
209 | * Call Controller Method |
||
210 | * |
||
211 | * @param string $http_method HTTP method |
||
212 | * @param array $argv controller, method [, arg1, ...] |
||
213 | * @param array|string $request_params POST params/GET params|raw_input_stream |
||
214 | */ |
||
215 | protected function callControllerMethod($http_method, $argv, $request_params) |
||
259 | |||
260 | /** |
||
261 | * Request to URI |
||
262 | * |
||
263 | * @param string $http_method HTTP method |
||
264 | * @param string $uri URI string |
||
265 | * @param array|string $request_params POST params/GET params|raw_input_stream |
||
266 | */ |
||
267 | protected function requestUri($http_method, $uri, $request_params) |
||
299 | |||
300 | protected function callHook($hook) |
||
309 | |||
310 | protected function setRawInputStream($string) |
||
322 | |||
323 | protected function createAndCallController($class, $method, $params, $call_display = true) |
||
386 | |||
387 | /** |
||
388 | * Get HTTP Status Code Info |
||
389 | * |
||
390 | * @return array ['code' => code, 'text' => text] |
||
391 | * @throws LogicException |
||
392 | */ |
||
393 | public function getStatus() |
||
403 | } |
||
404 |
You can fix this by adding a namespace to your class:
When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.