Repository navigation
Conversation
|
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 Core Committers: Use this line as a base for the props when committing in SVN: To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
huzaifaalmesbah
left a comment
There was a problem hiding this comment.
Thanks for working on this, @irozum! I really appreciate you covering the zero-count wording in get_test_plugin_version() and get_test_theme_version(); neither method had a test in the Site Health suite before, and emptying the theme directories to reach the no-themes branch is a neat way to get there.
One note on the ticket: #56134 was closed as fixed in 6.1, so it can't take new commits. Coverage additions without a ticket of their own usually go under the release's test umbrella ticket, which for 7.2 is #65819. Would you be open to updating the Trac ticket: link in the description to that one?
I left one small note inline as well.
AI Review: Opus 5.5
| * @covers ::get_test_plugin_version | ||
| */ | ||
| public function test_get_test_plugin_version_with_no_active_plugins() { | ||
| update_option( 'active_plugins', array() ); |
There was a problem hiding this comment.
On multisite, is_plugin_active() also counts network-activated plugins, so this relies on active_sitewide_plugins being empty in the test environment. Would it be worth clearing that too when is_multisite(), so the "no active plugins" precondition is explicit in both setups?
What this covers: Adds unit tests for
WP_Site_Health::get_test_plugin_version()andWP_Site_Health::get_test_theme_version(), specifically the zero-count messaging branch that [53816] / [53817] introduced for this ticket.Why these cases: Before [53816], a site with 0 active plugins (or 0 installed themes) got the confusing "Your site has 0 active plugins, and they are all up to date." wording. The fix added a dedicated branch for the zero case ("Your site does not have any active plugins." / "...does not have any installed themes."), but neither method had any test coverage at all, so nothing guards that wording today.
test_get_test_plugin_version_with_no_active_plugins— setsactive_pluginsto an empty array and asserts the description contains the zero-plugins message.test_get_test_theme_version_with_no_installed_themes— temporarily points$wp_theme_directoriesat an empty list (clearing the themes cache, same pattern used inTests_Theme_ThemeDir) sowp_get_themes()returns no themes, then asserts both thegoodstatus and the zero-themes message.Test-only change: this PR adds no production behaviour —
git diff trunktouches onlytests/phpunit/tests/admin/wpSiteHealth.php. Each new test was verified to fail when the corresponding message string insrc/wp-admin/includes/class-wp-site-health.phpis altered, then verified to pass again once reverted.Trac ticket: https://core.trac.wordpress.org/ticket/56134
This is a follow-up to [53816] (and its coding-standards follow-up [53817]), which already fixed and closed this ticket — these tests just add the missing coverage.
Use of AI Tools
AI assistance: Yes
Tool(s): Claude Code
Model(s): Claude Sonnet 5
Used for: Picking the ticket, reading the existing fix and surrounding code to determine the exact untested branches, writing the two test methods, and running the red/green verification loop. I reviewed the diff and test output before opening this PR.
This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request.
🤖 Generated with Claude Code