File tree Expand file tree Collapse file tree 1 file changed +48
-18
lines changed Expand file tree Collapse file tree 1 file changed +48
-18
lines changed Original file line number Diff line number Diff line change 26
26
27
27
use function date ;
28
28
use function getOptionsMysql ;
29
+ use function phpversion ;
29
30
use function uniqid ;
31
+ use function version_compare ;
32
+
33
+ use const PHP_VERSION ;
30
34
31
35
class ToArrayCest
32
36
{
@@ -309,24 +313,50 @@ public function mvcModelToArrayExecuteColumnNotInColumnMap(DatabaseTester $I)
309
313
$ result ->next ();
310
314
$ result ->rewind ();
311
315
312
- $ expected = [
313
- [
314
- 'id ' => '4 ' ,
315
- 'cst_id ' => '1 ' ,
316
- 'status_flag ' => '0 ' ,
317
- 'title ' => $ title ,
318
- 'total ' => '111.26 ' ,
319
- 'created_at ' => $ date ,
320
- ],
321
- [
322
- 'id ' => '5 ' ,
323
- 'cst_id ' => '2 ' ,
324
- 'status_flag ' => '1 ' ,
325
- 'title ' => $ title ,
326
- 'total ' => '222.19 ' ,
327
- 'created_at ' => $ date ,
328
- ],
329
- ];
316
+ /**
317
+ * This needs to be here because of how PDO works in PHP 8.0 vs 8.1+
318
+ */
319
+ if (version_compare (PHP_VERSION , '8.1.0 ' , '< ' )) {
320
+ // PHP 8.0.x
321
+ $ expected = [
322
+ [
323
+ 'id ' => '4 ' ,
324
+ 'cst_id ' => '1 ' ,
325
+ 'status_flag ' => '0 ' ,
326
+ 'title ' => $ title ,
327
+ 'total ' => '111.26 ' ,
328
+ 'created_at ' => $ date ,
329
+ ],
330
+ [
331
+ 'id ' => '5 ' ,
332
+ 'cst_id ' => '2 ' ,
333
+ 'status_flag ' => '1 ' ,
334
+ 'title ' => $ title ,
335
+ 'total ' => '222.19 ' ,
336
+ 'created_at ' => $ date ,
337
+ ],
338
+ ];
339
+ } else {
340
+ // PHP 8.1.x+
341
+ $ expected = [
342
+ [
343
+ 'id ' => 4 ,
344
+ 'cst_id ' => 1 ,
345
+ 'status_flag ' => 0 ,
346
+ 'title ' => $ title ,
347
+ 'total ' => 111.26 ,
348
+ 'created_at ' => $ date ,
349
+ ],
350
+ [
351
+ 'id ' => 5 ,
352
+ 'cst_id ' => 2 ,
353
+ 'status_flag ' => 1 ,
354
+ 'title ' => $ title ,
355
+ 'total ' => 222.19 ,
356
+ 'created_at ' => $ date ,
357
+ ],
358
+ ];
359
+ }
330
360
$ actual = $ result ->toArray ();
331
361
$ I ->assertSame ($ expected , $ actual );
332
362
}
You can’t perform that action at this time.
0 commit comments