Repository navigation
Conversation
…data(). See #66560.
|
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.
🟢 Approval recommended
No active review issues are recorded for the added plugin dependency API and directory-mapping tests.
No open issues 🎉
What changed in this PR
Adds unit tests for WordPress plugin dependency API data and plugin-directory mapping, without changing production code.
Changes:
- Covers screen restrictions, cached data, API requests, transient refreshes, and API errors.
- Tests fallback names, removal of stale or empty data, and sorting by slug.
- Verifies cached and newly generated plugin-directory mappings.
| File | Description |
|---|---|
tests/phpunit/tests/admin/plugin-dependencies/getDependencyApiData.php |
Adds tests for get_dependency_api_data() and get_plugin_dirnames(), with mocked API responses and transient cleanup. |
Review effort: Balanced
huzaifaalmesbah
left a comment
There was a problem hiding this comment.
Awesome work on this, @hmbashar! The tests for WP_Plugin_Dependencies::get_dependency_api_data() are very comprehensive, properly testing transients, circular dependencies, error responses, and directory mapping.
Clean mocking via the plugins_api filter and proper static cleanup in tear_down(). All 97 CI checks pass.
Looks ready to land!
AI Review: Gemini 3.8 Flash
Summary
Adds tests for
WP_Plugin_Dependencies::get_dependency_api_data()andget_plugin_dirnames(). The notice for unmet dependencies on a network (the other lines that Codecov shows) already has a test that only runs on multisite, and the code of the Ajax request has its own test class, so these are the parts that were left.Namekey, and the data and the time to ask again are kept in transients.get_plugin_dirnames()returns the folders that it listed before, and lists the plugin folders by slug.Testing
Mutation check: 17 changes to the two methods (the screen check, the cached data, the transients, the names, the API errors, the removal, the sorting and the cache of the folders) were each caught by a test.
The tests use the base class of the Plugin Dependencies tests to set the static properties.
Trac ticket: https://core.trac.wordpress.org/ticket/66560
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.