UtilsTest: fix the test failure by jrfnl · Pull Request #5997 · wp-cli/wp-cli
Tests on PHP 8.1 and higher (which are running PHPUnit 10+) are failing with the below message: ``` An error occurred inside PHPUnit. Message: Interface "WpOrg\Requests\Transport" not found Location: /home/runner/work/wp-cli/wp-cli/tests/mock-requests-transport.php:6 ``` This may be due to the test classes being loaded (to count the number of tests) before the test bootstrap is being run (which includes the autoloaders). If that "guess" is correct, this patch should fix this.
While these tests are not showing errors at this time, it is still best practice to include files in the test `set_up_before_class()` method, not when the file is being read. This applies this change to all other test files which were using the anti-pattern.
jrfnl
deleted the
feature/fix-utils-test
branch
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters