@@ -311,12 +311,15 @@ private function createPhpunitJobs(
311
311
]);
312
312
} else {
313
313
$ cmsMajor = BranchLogic::getCmsMajor ($ this ->repoData , $ this ->branch , $ this ->getComposerJsonContent ()) ?: MetaData::LOWEST_SUPPORTED_CMS_MAJOR ;
314
+ $ dbsAdded = [];
315
+ $ db = in_array ($ cmsMajor , ['4 ' , '5 ' ]) ? DB_MYSQL_57 : DB_MARIADB ;
314
316
$ matrix ['include ' ][] = $ this ->createJob (0 , [
315
317
'composer_args ' => '--prefer-lowest ' ,
316
- 'db ' => in_array ( $ cmsMajor , [ ' 4 ' , ' 5 ' ]) ? DB_MYSQL_57 : DB_MARIADB ,
318
+ 'db ' => $ db ,
317
319
'phpunit ' => true ,
318
320
'phpunit_suite ' => $ suite ,
319
321
]);
322
+ $ dbsAdded [] = $ db ;
320
323
if ($ cmsMajor === '4 ' ) {
321
324
if (!$ this ->doRunPhpCoverage ($ run )) {
322
325
// this same mysql pdo test is also created for the phpcoverage job, so only add it here if
@@ -334,14 +337,25 @@ private function createPhpunitJobs(
334
337
'phpunit_suite ' => $ suite ,
335
338
]);
336
339
} else {
337
- // phpunit tests for cms 5 are run on php 8.1, 8.2 or 8.3 and mysql 8.0 or mariadb
340
+ // phpunit tests for cms 5 are run on php 8.1, 8.2 or 8.3 and mysql 8.0, 8.4 or mariadb
338
341
$ phpToDB = $ this ->generatePhpToDBMap ();
342
+ $ lastPhp = null ;
339
343
foreach ($ phpToDB as $ php => $ db ) {
340
344
$ matrix ['include ' ][] = $ this ->createJob ($ this ->getIndexByPHPVersion ($ php ), [
341
345
'db ' => $ db ,
342
346
'phpunit ' => true ,
343
347
'phpunit_suite ' => $ suite ,
344
348
]);
349
+ $ dbsAdded [] = $ db ;
350
+ $ lastPhp = $ php ;
351
+ }
352
+ $ dbNotAdded = array_diff ($ this ->getDBs (), $ dbsAdded );
353
+ foreach ($ dbNotAdded as $ db ) {
354
+ $ matrix ['include ' ][] = $ this ->createJob ($ this ->getIndexByPHPVersion ($ lastPhp ), [
355
+ 'db ' => $ db ,
356
+ 'phpunit ' => true ,
357
+ 'phpunit_suite ' => $ suite ,
358
+ ]);
345
359
}
346
360
}
347
361
}
@@ -365,6 +379,18 @@ private function getIndexByPHPVersion(string $version): int
365
379
return array_search ($ version , $ this ->getListOfPhpVersionsByBranchName ()) ?? 0 ;
366
380
}
367
381
382
+ /**
383
+ * Return a list of DBS to test against for the current CMS major
384
+ */
385
+ private function getDBs ()
386
+ {
387
+ $ cmsMajor = BranchLogic::getCmsMajor ($ this ->repoData , $ this ->branch , $ this ->getComposerJsonContent ()) ?: MetaData::LOWEST_SUPPORTED_CMS_MAJOR ;
388
+ if ($ cmsMajor === '5 ' ) {
389
+ return [DB_MARIADB , DB_MYSQL_80 , DB_MYSQL_84 ];
390
+ }
391
+ return [DB_MYSQL_80 , DB_MYSQL_84 , DB_MARIADB ];
392
+ }
393
+
368
394
/**
369
395
* Generate a map of php versions to db versions
370
396
* e.g. [ '8.1' => 'mariadb', '8.2' => 'mysql80' ]
@@ -373,12 +399,7 @@ private function generatePhpToDBMap(): array
373
399
{
374
400
$ map = [];
375
401
$ phpVersions = $ this ->getListOfPhpVersionsByBranchName ();
376
- $ cmsMajor = BranchLogic::getCmsMajor ($ this ->repoData , $ this ->branch , $ this ->getComposerJsonContent ()) ?: MetaData::LOWEST_SUPPORTED_CMS_MAJOR ;
377
- if ($ cmsMajor === '5 ' ) {
378
- $ dbs = [DB_MARIADB , DB_MYSQL_80 ];
379
- } else {
380
- $ dbs = [DB_MYSQL_80 , DB_MARIADB ];
381
- }
402
+ $ dbs = $ this ->getDBs ();
382
403
foreach ($ phpVersions as $ key => $ phpVersion ) {
383
404
if (count ($ phpVersions ) < 3 ) {
384
405
$ map [$ phpVersion ] = $ dbs [$ key ];
@@ -387,7 +408,6 @@ private function generatePhpToDBMap(): array
387
408
$ map [$ phpVersion ] = array_key_exists ($ key , $ dbs ) ? $ dbs [$ key - 1 ] : DB_MYSQL_80 ;
388
409
}
389
410
}
390
-
391
411
return $ map ;
392
412
}
393
413
0 commit comments