19
19
use CodeIgniter \Database \MigrationRunner ;
20
20
use CodeIgniter \Database \Seeder ;
21
21
use CodeIgniter \Events \Events ;
22
+ use CodeIgniter \HTTP \Header ;
22
23
use CodeIgniter \Router \RouteCollection ;
23
24
use CodeIgniter \Session \Handlers \ArrayHandler ;
24
25
use CodeIgniter \Test \Mock \MockCache ;
@@ -72,6 +73,8 @@ abstract class CIUnitTestCase extends TestCase
72
73
73
74
/**
74
75
* Store of identified traits.
76
+ *
77
+ * @var array<class-string, class-string>|null
75
78
*/
76
79
private ?array $ traits = null ;
77
80
@@ -109,9 +112,9 @@ abstract class CIUnitTestCase extends TestCase
109
112
110
113
/**
111
114
* The seed file(s) used for all tests within this test case.
112
- * Should be fully-namespaced or relative to $basePath
115
+ * Should be fully-namespaced or relative to $basePath.
113
116
*
114
- * @var class-string<Seeder>|list<class-string<Seeder>>
117
+ * @var ''| class-string<Seeder>|list<class-string<Seeder>>
115
118
*/
116
119
protected $ seed = '' ;
117
120
@@ -127,9 +130,9 @@ abstract class CIUnitTestCase extends TestCase
127
130
* The namespace(s) to help us find the migration classes.
128
131
* `null` is equivalent to running `spark migrate --all`.
129
132
* Note that running "all" runs migrations in date order,
130
- * but specifying namespaces runs them in namespace order (then date)
133
+ * but specifying namespaces runs them in namespace order (then date).
131
134
*
132
- * @var array |string|null
135
+ * @var list<string> |string|null
133
136
*/
134
137
protected $ namespace = 'Tests\Support ' ;
135
138
@@ -156,17 +159,17 @@ abstract class CIUnitTestCase extends TestCase
156
159
protected $ migrations ;
157
160
158
161
/**
159
- * Seeder instance
162
+ * Seeder instance.
160
163
*
161
- * @var Seeder
164
+ * @var Seeder|null
162
165
*/
163
166
protected $ seeder ;
164
167
165
168
/**
166
169
* Stores information needed to remove any
167
- * rows inserted via $this->hasInDatabase();
170
+ * rows inserted via $this->hasInDatabase().
168
171
*
169
- * @var array
172
+ * @var list< array<int|string, mixed>>
170
173
*/
171
174
protected $ insertCache = [];
172
175
@@ -186,27 +189,27 @@ abstract class CIUnitTestCase extends TestCase
186
189
* Values to be set in the SESSION global
187
190
* before running the test.
188
191
*
189
- * @var array
192
+ * @var array<int|string, mixed>
190
193
*/
191
194
protected $ session = [];
192
195
193
196
/**
194
- * Enabled auto clean op buffer after request call
197
+ * Enabled auto clean op buffer after request call.
195
198
*
196
199
* @var bool
197
200
*/
198
201
protected $ clean = true ;
199
202
200
203
/**
201
- * Custom request's headers
204
+ * Custom request's headers.
202
205
*
203
- * @var array
206
+ * @var array<string, Header|list<Header>>
204
207
*/
205
208
protected $ headers = [];
206
209
207
210
/**
208
211
* Allows for formatting the request body to what
209
- * the controller is going to expect
212
+ * the controller is going to expect.
210
213
*
211
214
* @var string
212
215
*/
@@ -276,7 +279,7 @@ protected function tearDown(): void
276
279
* Checks for traits with corresponding
277
280
* methods for setUp or tearDown.
278
281
*
279
- * @param string $stage 'setUp' or 'tearDown'
282
+ * @param 'setUp'| 'tearDown' $stage
280
283
*/
281
284
private function callTraitMethods (string $ stage ): void
282
285
{
@@ -298,7 +301,7 @@ private function callTraitMethods(string $stage): void
298
301
// --------------------------------------------------------------------
299
302
300
303
/**
301
- * Resets shared instanced for all Factories components
304
+ * Resets shared instanced for all Factories components.
302
305
*
303
306
* @return void
304
307
*/
@@ -308,7 +311,7 @@ protected function resetFactories()
308
311
}
309
312
310
313
/**
311
- * Resets shared instanced for all Services
314
+ * Resets shared instanced for all Services.
312
315
*
313
316
* @return void
314
317
*/
@@ -318,7 +321,7 @@ protected function resetServices(bool $initAutoloader = true)
318
321
}
319
322
320
323
/**
321
- * Injects the mock Cache driver to prevent filesystem collisions
324
+ * Injects the mock Cache driver to prevent filesystem collisions.
322
325
*
323
326
* @return void
324
327
*/
@@ -328,7 +331,7 @@ protected function mockCache()
328
331
}
329
332
330
333
/**
331
- * Injects the mock email driver so no emails really send
334
+ * Injects the mock email driver so no emails really send.
332
335
*
333
336
* @return void
334
337
*/
@@ -338,7 +341,7 @@ protected function mockEmail()
338
341
}
339
342
340
343
/**
341
- * Injects the mock session driver into Services
344
+ * Injects the mock session driver into Services.
342
345
*
343
346
* @return void
344
347
*/
0 commit comments