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

Restore compatibility with WordPress <6.1 #748

Merged
merged 6 commits into from
Aug 23, 2024

Conversation

BrianHenryIE
Copy link
Contributor

WordPress 6.1 renamed wp-includes/wp-db.php to wp-includes/class-wpdb.php, WP Browser looks only for wp-includes/class-wpdb.php. This PR checks does it exist and otherwise uses the older file. This allows testing older versions of WordPress.

$ codecept run wpunit

Codeception PHP Testing Framework v4.2.2 https://helpukrainewin.org
Powered by PHPUnit 9.6.20 by Sebastian Bergmann and contributors.
PHP Warning:  require_once(/Users/brian.henry/Sites/my-plugin/wordpress/wp-includes/class-wpdb.php): Failed to open stream: No such file or directory in /Users/brian.henry/Sites/my-plugin/vendor/lucatume/wp-browser/includes/core-phpunit/includes/install.php on line 43
PHP Stack trace:
PHP   1. {main}() /Users/brian.henry/Sites/my-plugin/vendor/lucatume/wp-browser/includes/core-phpunit/includes/install.php:0
PHP Fatal error:  Uncaught Error: Failed opening required '/Users/brian.henry/Sites/my-plugin/wordpress/wp-includes/class-wpdb.php' (include_path='.:/opt/homebrew/Cellar/php@8.0/8.0.30_3/share/php@8.0/pear') in /Users/brian.henry/Sites/my-plugin/vendor/lucatume/wp-browser/includes/core-phpunit/includes/install.php:43
Stack trace:
#0 {main}
  thrown in /Users/brian.henry/Sites/my-plugin/vendor/lucatume/wp-browser/includes/core-phpunit/includes/install.php on line 43
PHP Fatal error:  Uncaught Codeception\Exception\ModuleException: lucatume\WPBrowser\Module\WPLoader: WordPress bootstrap failed.
 in /Users/brian.henry/Sites/my-plugin/vendor/lucatume/wp-browser/src/Module/WPLoader.php:1033
Stack trace:
#0 [internal function]: lucatume\WPBrowser\Module\WPLoader->lucatume\WPBrowser\Module\{closure}('', 8)
#1 {main}
  thrown in /Users/brian.henry/Sites/my-plugin/vendor/lucatume/wp-browser/src/Module/WPLoader.php on line 1033
Script codecept run wpunit handling the test event returned with error code 255

@lucatume
Copy link
Owner

Thanks @BrianHenryIE for the report and the fix.

That file is pulled form the Core PHPUnit test suite by means of the bin/update_core_phpunit_includes script. To keep that process automated, I will need to update the patches to included the install.php file.
This is to say the fix is less straighforward that it might look.

I will build on this to include the fix in the automation flow.

@lucatume lucatume merged commit d69450b into lucatume:master Aug 23, 2024
51 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants