WordPress / plugin-check

A repository for the new Plugin Check plugin from the WordPress Performance and Plugins Team.
https://wordpress.org/plugins/plugin-check/
GNU General Public License v2.0
266 stars 53 forks source link

Ensure runtime environment is set up before testing `Universal_Runtime_Preparation` #785

Closed felixarntz closed 1 week ago

felixarntz commented 1 week ago

Fixes #784

Follow up to #768.

github-actions[bot] commented 1 week ago

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: felixarntz <flixos90@git.wordpress.org>
Co-authored-by: ernilambar <rabmalin@git.wordpress.org>
Co-authored-by: davidperezgar <davidperez@git.wordpress.org>
Co-authored-by: swissspidy <swissspidy@git.wordpress.org>
Co-authored-by: mukeshpanchal27 <mukesh27@git.wordpress.org>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

davidperezgar commented 1 week ago

I'm having the same problems running npm run test-php

[12-Nov-2024 21:13:36 UTC] WordPress database error Table 'tests-wordpress.wp_pc_options' doesn't exist for query SELECT option_name, option_value FROM wp_pc_options WHERE option_name IN ('_site_transient_theme_roots','_site_transient_timeout_theme_roots') made by include('phpvfscomposer:///plugins/plugin-check/build-phpunit/vendor/phpunit/phpunit/phpunit'), PHPUnit\TextUI\Command::main, PHPUnit\TextUI\Command->run, PHPUnit\TextUI\TestRunner->run, PHPUnit\Framework\TestSuite->run, PHPUnit\Framework\TestSuite->run, PHPUnit\Framework\TestSuite->run, PHPUnit\Framework\TestCase->run, PHPUnit\Framework\TestResult->run, PHPUnit\Framework\TestCase->runBare, PHPUnit\Framework\TestCase->runTest, Plugin_Request_Utility_Tests->test_initialize_runner_with_ajax, do_action('muplugins_loaded'), WP_Hook->do_action, WP_Hook->apply_filters, WordPress\Plugin_Check\Utilities\Plugin_Request_Utility::WordPress\Plugin_Check\Utilities\{closure}, WordPress\Plugin_Check\Checker\Abstract_Check_Runner->prepare, WordPress\Plugin_Check\Checker\Abstract_Check_Runner->initialize_runtime, WordPress\Plugin_Check\Checker\Preparations\Universal_Runtime_Preparation->prepare, WordPress\Plugin_Check\Checker\Preparations\Use_Minimal_Theme_Preparation->prepare, search_theme_directories, get_site_transient, wp_prime_site_option_caches, wp_prime_network_option_caches, wp_prime_option_caches
felixarntz commented 1 week ago

@davidperezgar Can you try again now, after I committed https://github.com/WordPress/plugin-check/pull/785/commits/9703245dc5109f47747f36de8564f1605f962638?

davidperezgar commented 1 week ago

Yes! thanks! now it's solved. It gets an error but is not related with this problem. I share if it could helps:

There was 1 failure:

1) Localhost_Check_Tests::test_run_with_errors
Failed asserting that an array is not empty.

/var/www/html/wp-content/plugins/plugin-check/tests/phpunit/tests/Checker/Checks/Localhost_Check_Tests.php:23
phpvfscomposer:///var/www/html/wp-content/plugins/plugin-check/build-phpunit/vendor/phpunit/phpunit/phpunit:106