From 52866b0045caf7f7f046e2b17c5802fdc6774ab9 Mon Sep 17 00:00:00 2001 From: Gary Jones Date: Mon, 24 Jul 2023 12:58:17 +0100 Subject: [PATCH] CI: Install PHPUnit 7.5 for WP < 5.9 See https://make.wordpress.org/core/2021/09/27/changes-to-the-wordpress-core-php-test-suite/#integration-tests-ci-changes - PHPUnit 9 removed a `PHPUnit\Util\Getopt` class, but the [fix](https://core.trac.wordpress.org/changeset/51570/) wasn't applied to WP until 5.9. Also - exclude WP 5.7 on PHP 8.2 since it is not supported. --- .github/workflows/integrate.yml | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/.github/workflows/integrate.yml b/.github/workflows/integrate.yml index 8281bb03..d298a9b1 100644 --- a/.github/workflows/integrate.yml +++ b/.github/workflows/integrate.yml @@ -17,9 +17,7 @@ jobs: wordpress: [ '5.7', '6.2' ] allowed_failure: [ false ] include: - - php: '8.0' - # Ignore platform requirements, so that PHPUnit 7.5 can be installed on PHP 8.0 (and above). - composer-options: '--ignore-platform-reqs' + - php: '8.2' extensions: pcov ini-values: pcov.directory=., "pcov.exclude=\"~(vendor|tests)~\"" coverage: pcov @@ -29,7 +27,7 @@ jobs: allowed_failure: true exclude: - php: '8.2' - wordpress: '6.0' + wordpress: '5.7' fail-fast: false steps: @@ -44,10 +42,15 @@ jobs: ini-values: ${{ matrix.ini-values }} coverage: ${{ matrix.coverage }} + - name: Install PHPUnit 7.x for WP < 5.9 + if: ${{ matrix.wordpress < 5.9 }} + # Ignore platform requirements, so that PHPUnit 7.5 can be installed on PHP 8.0 (and above). + run: composer require --dev phpunit/phpunit:"^7.5" --ignore-platform-req=php+ --no-update --no-scripts --no-interaction + - name: Install Composer dependencies uses: ramsey/composer-install@v2 with: - composer-options: "${{ matrix.composer-options }}" + composer-options: --ignore-platform-req=php+ - name: Set up problem matchers for PHP run: echo "::add-matcher::${{ runner.tool_cache }}/php.json"