Repository navigation
Conversation
…_information(). See #66566.
|
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:
|
There was a problem hiding this comment.
🟡 Changes recommended
The error-handler wrapper uses E_WARNING instead of E_ALL, bypassing PHPUnit’s handler for other error levels and allowing unexpected errors during render() to go undetected by the tests.
1 open issue
What changed in this PR
Adds the first set of unit tests for install_plugin_information() under ticket #66566, covering plugin data and sections without changing production code.
Changes:
- Adds fixtures and a rendering helper that stops execution before the screen ends the request.
- Tests request handling, API errors, titles, markup sanitization, and banners.
- Covers section tabs, review-tab visibility, section selection, and link rewriting.
| File | Description |
|---|---|
tests/phpunit/tests/admin/includes/plugin-install/InstallPluginInformationSections_Test.php |
Adds unit tests for plugin information data and section rendering. |
Review effort: Balanced
huzaifaalmesbah
left a comment
There was a problem hiding this comment.
Thanks for working on this, @hmbashar! Splitting the install_plugin_information() coverage into focused parts is a great approach, and intercepting the screen via an admin footer exception handles output buffering cleanly.
All 97 CI checks are passing.
One observation on the custom error handler in render() (around line 159):
Currently, set_error_handler() is registered with E_WARNING. Because of that mask, other PHP diagnostic levels (like notices or deprecations) bypass this wrapper and go straight to PHP's default handler rather than PHPUnit's $previous_handler. Changing E_WARNING to E_ALL will ensure any unexpected notices or deprecations during render are properly caught and forwarded to the test runner.
Great work on this suite!
AI Review: Gemini 3.8 Flash
|
Thanks for the review, @huzaifaalmesbah. Changed the error handler mask from |

Summary
Part 1 of the tests for
install_plugin_information()(ticket #66566): the data and the sections. The function outputs the screen with the details of a plugin and ends the request, so the tests stop it with an action of the footer before that. The sidebar with the details of the plugin and the notices and the button in the footer are in other pull requests.version,author).Testing
Mutation check: 20 changes to this part of the function (the request, the sanitizing, the section that is shown, the banner, the tabs, the titles and the links) were each caught by a test. Removing
empty( $section )is equivalent, because an empty section is not a key of the sections either.The screen sends headers, which PHP refuses because the tests have output already, so the tests ignore that warning only. Other errors are still reported.
Trac ticket: https://core.trac.wordpress.org/ticket/66566
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.