wp-cli / core-command

Downloads, installs, updates, and manages a WordPress installation.
MIT License
49 stars 50 forks source link

Fix failing tests #272

Closed swissspidy closed 6 days ago

swissspidy commented 1 month ago

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 commented 1 month ago

Okay that didn't work 🤔

swissspidy commented 1 month ago

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

swissspidy commented 1 week ago

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 commented 1 week ago

@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 commented 6 days ago

PHP 8.4 tests are fixed in #274

mrsdizzie commented 6 days ago

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