Repository navigation
Conversation
…ugins(). See #66555.
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. 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. Props Bot commandsYou can trigger Props Bot actions by commenting on this PR:
|
… an array offset on PHP 8.5. See #66555.
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues are reported for the added plugin-status and bulk-activation tests.
No open issues 🎉
What changed in this PR
Adds PHPUnit coverage for plugin status checks and bulk activation in wp-admin/includes/plugin.php, extending existing tests without changing production code.
Changes:
- Covers active and inactive plugin checks, network activation status, and network-only plugin headers.
- Tests bulk activation success, per-plugin errors, redirects, and forwarding of silent and network-wide arguments.
- Adds temporary plugin fixtures with teardown cleanup.
| File | Description |
|---|---|
tests/phpunit/tests/admin/includes/plugin/isPluginActive.php |
Adds plugin status and network-only header tests. |
tests/phpunit/tests/admin/includes/plugin/activatePlugins.php |
Adds bulk activation, error handling, redirect, and argument-forwarding tests. |
Review effort: Balanced
huzaifaalmesbah
left a comment
There was a problem hiding this comment.
Great work on this, @hmbashar! Comprehensive coverage for activate_plugins(), silent activations, network activation checks, and status helpers (is_plugin_active(), is_plugin_inactive()).
The test isolation and global state restoration in tear_down() are cleanly handled, and all 96 CI matrix checks pass.
Looks ready to land!
AI Review: Gemini 3.8 Flash
|
A note for the review: 🤖 Addressed by Claude Code |
Summary
Adds tests for the plugin status and activation functions of
wp-admin/includes/plugin.phpthat the ticket lists.is_plugin_active()andis_plugin_inactive()already have a test for a plugin that is active and one that is not, andactivate_plugin()has its own tests, so these tests add what was missing.isPluginActive.phpis_plugin_active()andis_plugin_inactive()for a listed plugin, another plugin, a plugin that is not there, the folder of a plugin, a different case, an empty string,nullandtrue(the comparison is strict), and a plugin that is active for the network.is_plugin_active_for_network(): always false on a single site, and on a network true only for the plugins that are listed.is_network_only_plugin(): theNetworkheader (true,TRUE,false, another value, none), and a full path with spaces.activatePlugins.phpactivate_plugins()activates several plugins, or a single plugin that is not in an array.plugins_invaliderror with the error of each plugin that could not be activated, keyed by plugin, and still activates the other plugins.$silentand$network_widearguments are passed toactivate_plugin().Testing
Mutation check: 16 changes to
is_plugin_active(),is_plugin_inactive(),is_plugin_active_for_network(),is_network_only_plugin()andactivate_plugins()were each caught by a test, on single-site or on multisite (the checks that only matter on a network are caught by the multisite run).Trac ticket: https://core.trac.wordpress.org/ticket/66555
Use of AI Tools
AI assistance: Yes
Tool(s): Claude Code
Model(s): Claude Sonnet 5.5
Used for: Written with AI and manually reviewed by me.
This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.