Skip to content

Commit

Permalink
Build/Test Tools: Enable running the tests on PHP 8.4
Browse files Browse the repository at this point in the history
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](WordPress/wordpress-importer#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.
  • Loading branch information
jrfnl committed Oct 3, 2024
1 parent 03834fe commit d91e1ce
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 7 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/phpunit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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' ]
Expand Down Expand Up @@ -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 ]
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/reusable-phpunit-tests-v3.yml
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ jobs:

# __fakegroup__ is excluded to force PHPUnit to ignore the <exclude> 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__

Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/upgrade-testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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' ]
Expand Down Expand Up @@ -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' ]
Expand Down Expand Up @@ -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' ]
Expand Down
3 changes: 2 additions & 1 deletion .version-support-php.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
"8.0",
"8.1",
"8.2",
"8.3"
"8.3",
"8.4"
],
"6-6": [
"7.2",
Expand Down
20 changes: 20 additions & 0 deletions tests/phpunit/tests/import/parser.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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';

Expand All @@ -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 ) {
Expand Down Expand Up @@ -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 ) {
Expand Down Expand Up @@ -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 ) {
Expand Down

0 comments on commit d91e1ce

Please sign in to comment.