Skip to content

Commit ff07064

Browse files
authored
Merge pull request #84 from se7enxweb/copilot/fix-failing-github-actions-job
Fix PHPUnit matrix dependency resolution for PHP 8.1–8.3
2 parents c8e9307 + bc7a791 commit ff07064

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

.github/workflows/phpunit.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,11 @@ jobs:
7474
fi
7575
fi
7676
php -r '$file = getenv("CI_COMPOSER_FILE"); $data = json_decode(file_get_contents($file), true, 512, JSON_THROW_ON_ERROR); if (($phpunit = getenv("PHPUNIT_VERSION")) !== false && $phpunit !== "") { $data["require-dev"]["phpunit/phpunit"] = $phpunit; } $data["require-dev"]["mongodb/mongodb"] = "^1.21 || ^2.0"; file_put_contents($file, json_encode($data, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES) . PHP_EOL);'
77-
COMPOSER="${CI_COMPOSER_FILE}" composer install --prefer-dist --no-progress --no-interaction --ignore-platform-req=php --ignore-platform-req=ext-mongodb
77+
if [[ -n "${PHPUNIT_VERSION:-}" ]]; then
78+
COMPOSER="${CI_COMPOSER_FILE}" composer update phpunit/phpunit --with-all-dependencies --prefer-dist --no-progress --no-interaction --ignore-platform-req=php --ignore-platform-req=ext-mongodb
79+
else
80+
COMPOSER="${CI_COMPOSER_FILE}" composer install --prefer-dist --no-progress --no-interaction --ignore-platform-req=php --ignore-platform-req=ext-mongodb
81+
fi
7882
7983
- name: Ensure vendor is present
8084
run: |
@@ -173,7 +177,7 @@ jobs:
173177
cp composer.json "${CI_COMPOSER_FILE}"
174178
export PHPUNIT_VERSION="^11.5"
175179
php -r '$file = getenv("CI_COMPOSER_FILE"); $data = json_decode(file_get_contents($file), true, 512, JSON_THROW_ON_ERROR); if (($phpunit = getenv("PHPUNIT_VERSION")) !== false && $phpunit !== "") { $data["require-dev"]["phpunit/phpunit"] = $phpunit; } $data["require-dev"]["mongodb/mongodb"] = "^1.21 || ^2.0"; file_put_contents($file, json_encode($data, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES) . PHP_EOL);'
176-
COMPOSER="${CI_COMPOSER_FILE}" composer install --prefer-dist --no-progress --no-interaction --ignore-platform-req=php --ignore-platform-req=ext-mongodb
180+
COMPOSER="${CI_COMPOSER_FILE}" composer update phpunit/phpunit --with-all-dependencies --prefer-dist --no-progress --no-interaction --ignore-platform-req=php --ignore-platform-req=ext-mongodb
177181
178182
- name: Ensure vendor is present
179183
run: |

0 commit comments

Comments
 (0)