From d91e1ce99a560af9d9a6ac308203f6ff8a0fda51 Mon Sep 17 00:00:00 2001 From: jrfnl Date: Wed, 11 Sep 2024 07:27:34 +0200 Subject: [PATCH] Build/Test Tools: Enable running the tests on PHP 8.4 PHP 8.4 is expected to be released at the end of November 2024. Trac ticket 62061 contains a full analysis of the changes needed for WP to be ready for PHP 8.4 and all currently available patches for WP Core have been merged in the mean time. Enabling the tests to run in CI on PHP 8.4 allows WordPress core to prevent new PHP 8.4 compatibility issues from being introduced. Notes: * While a [patch has been pulled](https://github.com/WordPress/wordpress-importer/pull/172) for the Importer plugin, this patch has not been merged yet. This means there are currently still five failing tests. These failure are directly related to the Importer plugin and will be fixed once the PR for the plugin has been merged. To still allow WP Core to start structurally testing against PHP 8.4, these five tests have been set up now to be skipped on PHP 8.4. These tests skips should be removed again once the PR to the plugin has been merged. * Xdebug-related tests will not be run on PHP 8.4 at this time as the Docker image for PHP 8.4 does not contain Xdebug yet. Once a stable release of Xdebug 3.4.0 is available, it can be added to the Docker image and the test step can then be enabled for PHP 8.4. --- .github/workflows/phpunit-tests.yml | 4 ++-- .../workflows/reusable-phpunit-tests-v3.yml | 2 +- .github/workflows/upgrade-testing.yml | 6 +++--- .version-support-php.json | 3 ++- tests/phpunit/tests/import/parser.php | 20 +++++++++++++++++++ 5 files changed, 28 insertions(+), 7 deletions(-) diff --git a/.github/workflows/phpunit-tests.yml b/.github/workflows/phpunit-tests.yml index 31d18f9b10efa..50e4c940c2169 100644 --- a/.github/workflows/phpunit-tests.yml +++ b/.github/workflows/phpunit-tests.yml @@ -45,7 +45,7 @@ jobs: fail-fast: false matrix: os: [ ubuntu-latest ] - php: [ '7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3' ] + php: [ '7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3', '8.4' ] db-type: [ 'mysql' ] db-version: [ '5.7', '8.0', '8.1', '8.2', '8.3' ] tests-domain: [ 'example.org' ] @@ -116,7 +116,7 @@ jobs: fail-fast: false matrix: os: [ ubuntu-latest ] - php: [ '7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3' ] + php: [ '7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3', '8.4' ] db-type: [ 'mariadb' ] db-version: [ '10.4', '10.6', '10.11', '11.2' ] multisite: [ false, true ] diff --git a/.github/workflows/reusable-phpunit-tests-v3.yml b/.github/workflows/reusable-phpunit-tests-v3.yml index c9387d06a8451..fcdf88280874d 100644 --- a/.github/workflows/reusable-phpunit-tests-v3.yml +++ b/.github/workflows/reusable-phpunit-tests-v3.yml @@ -182,7 +182,7 @@ jobs: # __fakegroup__ is excluded to force PHPUnit to ignore the settings in phpunit.xml.dist. - name: Run (Xdebug) tests - if: ${{ inputs.php != '8.3' }} + if: ${{ inputs.php != '8.4' }} continue-on-error: ${{ inputs.allow-errors }} run: LOCAL_PHP_XDEBUG=true node ./tools/local-env/scripts/docker.js run php ./vendor/bin/phpunit -v --group xdebug --exclude-group __fakegroup__ diff --git a/.github/workflows/upgrade-testing.yml b/.github/workflows/upgrade-testing.yml index 25ba7e97080ba..85bd45b5a4eb4 100644 --- a/.github/workflows/upgrade-testing.yml +++ b/.github/workflows/upgrade-testing.yml @@ -43,7 +43,7 @@ jobs: fail-fast: false matrix: os: [ 'ubuntu-latest' ] - php: [ '7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3' ] + php: [ '7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3', '8.4' ] db-type: [ 'mysql' ] db-version: [ '5.7', '8.0' ] wp: [ '6.0', '6.1', '6.2', '6.3', '6.4', '6.5', '6.6' ] @@ -93,7 +93,7 @@ jobs: fail-fast: false matrix: os: [ 'ubuntu-latest' ] - php: [ '8.0', '8.1', '8.2', '8.3' ] + php: [ '8.0', '8.1', '8.2', '8.3', '8.4' ] db-type: [ 'mysql' ] db-version: [ '5.7', '8.0' ] wp: [ '5.3', '5.4', '5.5', '5.6', '5.7', '5.8', '5.9' ] @@ -143,7 +143,7 @@ jobs: fail-fast: false matrix: os: [ 'ubuntu-latest' ] - php: [ '8.0', '8.1', '8.2', '8.3' ] + php: [ '8.0', '8.1', '8.2', '8.3', '8.4' ] db-type: [ 'mysql' ] db-version: [ '5.7', '8.0' ] wp: [ '4.1', '4.2', '4.3', '4.4', '4.5' ] diff --git a/.version-support-php.json b/.version-support-php.json index 6d9f3708a5a46..720afc2cc0bcb 100644 --- a/.version-support-php.json +++ b/.version-support-php.json @@ -6,7 +6,8 @@ "8.0", "8.1", "8.2", - "8.3" + "8.3", + "8.4" ], "6-6": [ "7.2", diff --git a/tests/phpunit/tests/import/parser.php b/tests/phpunit/tests/import/parser.php index 874b754eee962..a28a7ade3e799 100644 --- a/tests/phpunit/tests/import/parser.php +++ b/tests/phpunit/tests/import/parser.php @@ -25,6 +25,10 @@ public function set_up() { * @covers WXR_Parser_XML::parse */ public function test_malformed_wxr() { + if ( PHP_VERSION_ID >= 80400 ) { + $this->markTestSkipped( 'The Importer plugin is not ready for PHP 8.4 yet. This skip should be removed once it is.' ); + } + $file = DIR_TESTDATA . '/export/malformed.xml'; // Regex based parser cannot detect malformed XML. @@ -42,6 +46,10 @@ public function test_malformed_wxr() { * @covers WXR_Parser_Regex::parse */ public function test_invalid_wxr() { + if ( PHP_VERSION_ID >= 80400 ) { + $this->markTestSkipped( 'The Importer plugin is not ready for PHP 8.4 yet. This skip should be removed once it is.' ); + } + $f1 = DIR_TESTDATA . '/export/missing-version-tag.xml'; $f2 = DIR_TESTDATA . '/export/invalid-version-tag.xml'; @@ -61,6 +69,10 @@ public function test_invalid_wxr() { * @covers WXR_Parser_Regex::parse */ public function test_wxr_version_1_1() { + if ( PHP_VERSION_ID >= 80400 ) { + $this->markTestSkipped( 'The Importer plugin is not ready for PHP 8.4 yet. This skip should be removed once it is.' ); + } + $file = DIR_TESTDATA . '/export/valid-wxr-1.1.xml'; foreach ( array( 'WXR_Parser_SimpleXML', 'WXR_Parser_XML', 'WXR_Parser_Regex' ) as $p ) { @@ -159,6 +171,10 @@ public function test_wxr_version_1_1() { * @covers WXR_Parser_Regex::parse */ public function test_wxr_version_1_0() { + if ( PHP_VERSION_ID >= 80400 ) { + $this->markTestSkipped( 'The Importer plugin is not ready for PHP 8.4 yet. This skip should be removed once it is.' ); + } + $file = DIR_TESTDATA . '/export/valid-wxr-1.0.xml'; foreach ( array( 'WXR_Parser_SimpleXML', 'WXR_Parser_XML', 'WXR_Parser_Regex' ) as $p ) { @@ -257,6 +273,10 @@ public function test_wxr_version_1_0() { * @covers WXR_Parser_Regex::parse */ public function test_escaped_cdata_closing_sequence() { + if ( PHP_VERSION_ID >= 80400 ) { + $this->markTestSkipped( 'The Importer plugin is not ready for PHP 8.4 yet. This skip should be removed once it is.' ); + } + $file = DIR_TESTDATA . '/export/crazy-cdata-escaped.xml'; foreach ( array( 'WXR_Parser_SimpleXML', 'WXR_Parser_XML', 'WXR_Parser_Regex' ) as $p ) {