Repository navigation
Tests: Add unit test coverage for WP_Site_Health::get_test_plugin_version() - #14582
huzaifaalmesbah wants to merge 2 commits into
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. |
There was a problem hiding this comment.
🟢 Approval recommended
Static review identified no blocking issues in the test-only changes; tests were not executed.
No open issues 🎉
What changed in this PR
Adds coverage for Site Health’s plugin-version check, complementing the zero-active-plugin case in #13960 without changing production code.
Changes:
- Tests up-to-date, outdated, missing, and inactive plugin scenarios.
- Verifies messages, action links, and single-site versus multisite behavior.
| File | Description |
|---|---|
| tests/phpunit/tests/admin/wpSiteHealthGetTestPluginVersion.php | Adds plugin fixtures and assertions for plugin-version health results. |
Review effort: Balanced
|
Small follow-up in af4abfe: the expected action links are now literal URLs instead of being built with |
lancewillett
left a comment
There was a problem hiding this comment.
The refreshed assertions passed the unit-tests audit, targeted randomized single-site and multisite runs, and PHPCS. CI is green, and the fresh Copilot review found no blockers.
AI review · gpt-6
|
PR #14582 landed in https://core.trac.wordpress.org/changeset/64667 |
Test `WP_Site_Health::get_test_plugin_version()` for active and inactive plugins, available updates, singular and plural descriptions, update links, and multisite behavior. Developed in: #14582 Props huzaifaalmesbah. See #65819. git-svn-id: https://develop.svn.wordpress.org/trunk@64667 602fd350-edb4-49c9-b593-d223f7449a82
Test `WP_Site_Health::get_test_plugin_version()` for active and inactive plugins, available updates, singular and plural descriptions, update links, and multisite behavior. Developed in: WordPress/wordpress-develop#14582 Props huzaifaalmesbah. See #65819. Built from https://develop.svn.wordpress.org/trunk@64667 git-svn-id: http://core.svn.wordpress.org/trunk@63817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Description
Adds tests for
WP_Site_Health::get_test_plugin_version(), the "Your plugins are all up to date" Site Health test. Only the case without active plugins is covered by an open PR (#13960); this PR leaves that case to it and covers the rest.The tests prime the plugins cache with test plugins, set which are active, and add updates to the
update_pluginstransient. They cover:goodresult for one active plugin and for several, with singular and plural sentences;criticalresult, its sentence and the network admin update link when one or more plugins have an update;recommendedresult, its sentence and the inactive plugins link for one or more inactive plugins;Removing or changing each branch of the method makes at least one test fail on single site or multisite.
One case is left out: when plugins have updates and some plugins are inactive, the inactive check sets the status to
recommended, replacing thecriticalstatus of the update check. That looks like a defect and can be handled in its own ticket.This is a test-only change; no production code is modified.
Testing Instructions
npm run test:php -- --filter Tests_Admin_wpSiteHealthGetTestPluginVersionnpm run test:php -- --filter Tests_Admin_wpSiteHealthGetTestPluginVersion -c tests/phpunit/multisite.xmlnpm run test:php -- --filter Tests_Admin_wpSiteHealthGetTestPluginVersion --order-by=randomnpm run test:php -- --group site-health,pluginsnode ./tools/local-env/scripts/docker.js run --rm php ./vendor/bin/phpcs tests/phpunit/tests/admin/wpSiteHealthGetTestPluginVersion.phpTrac ticket: https://core.trac.wordpress.org/ticket/65819
Use of AI Tools
AI assistance: Yes
Tool(s): Claude Code
Model(s): Claude Opus 5.5
Used for: Brainstorming edge-case scenarios and drafting test boilerplate; test architecture, assertions, and local PHPUnit verification were written and validated by me.