Skip to content
New issue

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

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

Already on GitHub? # to your account

Fix failing tests #272

Merged
merged 6 commits into from
Nov 24, 2024
Merged

Fix failing tests #272

merged 6 commits into from
Nov 24, 2024

Conversation

swissspidy
Copy link
Member

At the moment we don't hide PHP warnings and deprecations in Behat tests anymore, which helps surface potential issues with the tess.

There is currently 1 test failing because of that.

Example test run: https://github.com/wp-cli/core-command/actions/runs/11136463362/job/30948399200#step:11:36

001 Scenario: Make sure files are cleaned up with mixed case # features/core-update.feature:264
      Then STDOUT should be a number                         # features/core-update.feature:341
        Actual value: 'Deprecated: The PSR-0 `Requests_...` class names in the Request library are deprecated. Switch to the PSR-4 `WpOrg\\Requests\\...` class names at your earliest convenience. in /tmp/wp-cli-test-run--66fcaeaf29b076.48217376/wp-includes/class-requests.php on line 24
        4' (Exception)

This fix should address this warning.

@swissspidy swissspidy added this to the 2.1.19 milestone Oct 2, 2024
@swissspidy swissspidy requested a review from a team as a code owner October 2, 2024 10:55
@swissspidy
Copy link
Member Author

Okay that didn't work 🤔

@swissspidy swissspidy marked this pull request as draft October 2, 2024 11:09
@swissspidy
Copy link
Member Author

Not sure how I could silence the deprecations if not using an mu-plugin...

@swissspidy
Copy link
Member Author

Taking another stab at this...

So this test downgrades to WP 5.8 and then upgrades to 5.9 beta 1.

In 5.9 beta 1, wp-includes/class-requests.php is deprecated and triggers this deprecation notice.

The file is not loaded by WordPress anymore, but here it is loaded because of WP-CLI:

#0 phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Bootstrap/IncludeRequestsAutoloader.php(92): require_once()
#1 phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/bootstrap.php(83): WP_CLI\Bootstrap\IncludeRequestsAutoloader->process(Object(WP_CLI\Bootstrap\BootstrapState))
#2 phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/wp-cli.php(32): WP_CLI\bootstrap()
#3 phar:///usr/local/bin/wp/php/boot-phar.php(20): include('phar:///usr/loc...')
#4 /usr/local/bin/wp(4): include('phar:///usr/loc...')

Now, this whole change in 5.9 beta 1 was later reverted because of issues with the upgrader, and only reintroduced in 6.2.

So I think it makes sense to change the test to use 6.2 instead of 5.9 beta 1...

@swissspidy swissspidy marked this pull request as ready for review November 23, 2024 12:41
@swissspidy swissspidy changed the title Tests: Silence Requests deprecation Fix failing tests Nov 23, 2024
@swissspidy
Copy link
Member Author

@wp-cli/committers @schlessera This should now fix the failing tests that were encountered previously.

Only PHP 8.4 ones are not addressed, for those we'd need to require wp-cli/wp-cli 2.12 (which is a branch alias for the main branch). Maybe a new release is in order...

@swissspidy
Copy link
Member Author

PHP 8.4 tests are fixed in #274

@mrsdizzie mrsdizzie merged commit 3bcf32c into main Nov 24, 2024
33 of 37 checks passed
@mrsdizzie mrsdizzie deleted the fix-tests branch November 24, 2024 17:08
@mrsdizzie
Copy link
Member

Good detective work 🕵️‍♂️ This and the PHP 8.4 update means all tests pass again

# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants