diff --git a/.github/files/generate-ci-matrix.php b/.github/files/generate-ci-matrix.php index 1fa78d65d16d..ea62d1117708 100755 --- a/.github/files/generate-ci-matrix.php +++ b/.github/files/generate-ci-matrix.php @@ -61,9 +61,7 @@ 'timeout' => 20, // 2022-01-25: 5.6 tests have started timing out at 15 minutes. Previously: Successful runs seem to take ~8 minutes for PHP 5.6 and for the 7.4 trunk run, ~5.5-6 for 7.x and 8.0. ); } -// Uncomment this once WP trunk finally works with 8.1. Then merge into the above once WP latest does and we've cleaned up any problems in our own code. -// phpcs:ignore Squiz.PHP.CommentedOutCode.Found, Squiz.Commenting.BlockComment.NoEmptyLineBefore -/* +// Merge this into the above once we decide PHP 8.1 is stable and WP latest works with 8.1. $matrix[] = array( 'name' => 'PHP tests: PHP 8.1 WP trunk', 'script' => 'test-php', @@ -72,7 +70,6 @@ 'timeout' => 15, 'experimental' => true, ); -*/ // Uncomment this once WP trunk finally works with 8.2. Then merge into the above once WP latest does and we've cleaned up any problems in our own code. // phpcs:ignore Squiz.PHP.CommentedOutCode.Found, Squiz.Commenting.BlockComment.NoEmptyLineBefore /* diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index fd045bb3ad60..10e112f9a495 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -149,6 +149,14 @@ jobs: fi fi + if [[ "$WP_BRANCH" == 'trunk' && ( "$TEST_SCRIPT" == "test-php" || "$TEST_SCRIPT" == "test-coverage" ) ]]; then + VER=$(composer --format=json --working-dir="$DIR" show | jq -r '.installed[] | select( .name == "roots/wordpress" ) | .version') + if [[ -n "$VER" ]]; then + echo 'Supposed to run tests against WordPress trunk, so upgrading roots/wordpress to dev-nightly' + composer --working-dir="$DIR" require --dev roots/wordpress="dev-nightly as $VER" + fi + fi + mkdir -p "artifacts/$SLUG" export ARTIFACTS_DIR="$GITHUB_WORKSPACE/artifacts/$SLUG" if [[ "$TEST_SCRIPT" == "test-coverage" ]]; then diff --git a/projects/packages/connection/changelog/update-reenable-php-8.1-tests b/projects/packages/connection/changelog/update-reenable-php-8.1-tests new file mode 100644 index 000000000000..01800185d44a --- /dev/null +++ b/projects/packages/connection/changelog/update-reenable-php-8.1-tests @@ -0,0 +1,5 @@ +Significance: patch +Type: fixed +Comment: Set `REQUESTS_SILENCE_PSR0_DEPRECATIONS` when running tests for compat with WP trunk. + + diff --git a/projects/packages/connection/tests/php/bootstrap.php b/projects/packages/connection/tests/php/bootstrap.php index a7711b487e0f..7c950bc97fab 100644 --- a/projects/packages/connection/tests/php/bootstrap.php +++ b/projects/packages/connection/tests/php/bootstrap.php @@ -10,6 +10,10 @@ */ require_once __DIR__ . '/../../vendor/autoload.php'; +// Disable warning about deprecated request library. +// @todo Remove this once we drop support for WordPress 6.1 +define( 'REQUESTS_SILENCE_PSR0_DEPRECATIONS', true ); + // Work around WordPress bug when `@runInSeparateProcess` is used. if ( empty( $_SERVER['SCRIPT_FILENAME'] ) ) { $_SERVER['SCRIPT_FILENAME'] = __DIR__ . '/vendor/phpunit/phpunit/phpunit';