Skip to content

Commit 1c3d658

Browse files
committed
Minimum PHP 8.2 refactoring, updated db versions for multi-db testing
1 parent 3bd852d commit 1c3d658

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

run-tests-against-multiple-db-versions-docker.php

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -247,12 +247,16 @@ function readableElapsedTime($microtime, $format = null, $round = 3) {
247247

248248
$retval=null;
249249
$output=null;
250+
$sanitized_db_version_name = \str_replace([':','.'],['_', '_'], $db_version);
250251
$run_container_command = \str_replace(
251252
$runtime_name_placeholder,
252-
$db_version,
253+
$sanitized_db_version_name,
253254
$command['run_container']
254255
);
255-
$container_names_to_stop[] = $db_versions;
256+
$container_names_to_stop[] = [
257+
'container_name'=>$sanitized_db_version_name,
258+
'image_name'=>$db_version,
259+
];
256260
echoWithLineBreaks($run_container_command);
257261
exec($run_container_command, $output, $retval);
258262

@@ -279,12 +283,12 @@ function readableElapsedTime($microtime, $format = null, $round = 3) {
279283

280284
foreach($container_names_to_stop as $container_to_stop) {
281285

282-
echoWithLineBreaks("docker stop {$container_to_stop}");
283-
system("docker stop {$container_to_stop}"); // stop the containers
286+
echoWithLineBreaks("docker stop {$container_to_stop['container_name']}");
287+
system("docker stop {$container_to_stop['container_name']}"); // stop the containers
284288

285289
// remove their images from the machine to save disk space
286-
echoWithLineBreaks("docker image rm --force {$container_to_stop}");
287-
system("docker image rm --force {$container_to_stop}");
290+
echoWithLineBreaks("docker image rm --force {$container_to_stop['image_name']}");
291+
system("docker image rm --force {$container_to_stop['image_name']}");
288292
}
289293

290294
if($phpunit_retval !== 0) {

0 commit comments

Comments
 (0)