Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tests/GH Actions: allow for upstream issue which prevented the PHP 8.1 builds from passing #131

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 16 additions & 5 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,23 @@ jobs:
experimental: [false]

include:
# Complement the builds run via the matrix with high/low WP builds for PHP 7.4 and 8.0.
# Complement the builds run via the matrix with high/low WP builds for PHP 7.4 up to 8.2.
# PHP 8.2 is sort of supported since WP 6.1.
# PHP 8.1 is sort of supported since WP 5.9 (with the exception of Requests, which was updated in WP 6.2).
# PHP 8.0 is sort of supported since WP 5.6.
# PHP 7.4 is supported since WP 5.3.
- php: '8.2'
wp: 'latest'
experimental: false
- php: '8.2'
wp: '6.1'
experimental: false
- php: '8.1'
wp: 'latest'
experimental: false
- php: '8.1'
wp: '5.9'
experimental: false
- php: '8.0'
wp: 'latest'
experimental: false
Expand Down Expand Up @@ -61,10 +75,7 @@ jobs:
experimental: false

# Experimental builds. These are allowed to fail.
- php: '8.1'
wp: 'trunk'
experimental: true
- php: '8.2'
- php: '8.3'
wp: 'trunk'
experimental: true
- php: '7.4'
Expand Down
5 changes: 5 additions & 0 deletions phpunit/tests/import.php
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,11 @@ public function test_slashes_should_not_be_stripped() {
* Note: this test doesn't test anything else of the functionality in the `WP_Import::fetch_remote_file()` method!
*/
public function test_fetch_remote_file_php81_deprecation() {
// Temporary until WP updates to Requests 2.0.0.
if ( PHP_VERSION_ID >= 80100 ) {
$this->markTestSkipped( 'Test will fail on PHP 8.1+ until WP has upgraded to Requests 2.0.0. Temporarily skipping the test.' );
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't seem like the best fix - Yes, it'll make the tests pass, but that's it.

We can wait on trunk to fix the notices, or add a workaround into the test structure that allows for discarding the deprecation notices.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, the fix for Core (upgrade Requests) has been available since November 2021 and it doesn't look like anything is happening there for now, so that can be a long wait.

The reason I choose this (simple) work-around is to safeguard that no new PHP 8.1/8.2 incompatibilities will be introduced in the plugin in the mean time while we're waiting for Core.
A "known to fail" build will be disregarded by most devs, which means that new incompatibilities can slip in a little too easily - as they have in Core -.

The test which is being skipped is a specific one, which only tests for a specific PHP 8.1 deprecation to not be thrown. It doesn't actually test the functionality in the plugin, which is why IMO this is the simplest way to safeguard the plugin for PHP 8.1/8.2 right now.
Also see: #113

So yes, I agree it may not be the best fix, but it is not meant to be. It is meant to only be a temporary measure,

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

WP 6.2 includes Requests 2.0.0, so when testing with WP 6.2, the tests should now pass without the first commit.

}

$importer = new WP_Import();
$result = $importer->fetch_remote_file( 'https://example.com', array() );

Expand Down
Loading