Repository navigation
Tests: Add unit test coverage for WP_Plugin_Dependencies::get_circular_dependencies() - #14584
huzaifaalmesbah wants to merge 1 commit into
Conversation
…r_dependencies().
|
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
The focused test-only changes match the existing implementation and isolation helpers, with no unresolved findings.
No open issues 🎉
What changed in this PR
Adds unit tests for WordPress plugin dependency cycle detection without changing production code.
Changes:
- Tests cached results and unread dependencies.
- Verifies stored pairs and slugs for self-dependencies and multi-plugin loops.
- Covers dependency chains without loops and missing dependencies.
| File | Description |
|---|---|
| tests/phpunit/tests/admin/plugin-dependencies/getCircularDependencies.php | Adds cycle-detection tests using shared state-isolation helpers. |
Review effort: Balanced
lancewillett
left a comment
There was a problem hiding this comment.
The unit-tests audit found no landing blockers. The affected classes passed individually and together across three randomized seeds on single-site and multisite, with no failures or skips. PHPCS passed.
Optional follow-up: parameterize the cached-dependencies case with an empty cached array while retaining cyclic input. That would protect the empty-cache boundary without adding a separate test.
AI review · gpt-6
|
PR #14584 landed in https://core.trac.wordpress.org/changeset/64666 |
Test `WP_Plugin_Dependencies::get_circular_dependencies()` and `WP_Plugin_Dependencies::check_for_circular_dependencies()` for cached results, acyclic dependencies, missing plugins, and dependency cycles. Developed in: #14584 Props huzaifaalmesbah. See #65819. git-svn-id: https://develop.svn.wordpress.org/trunk@64666 602fd350-edb4-49c9-b593-d223f7449a82
Test `WP_Plugin_Dependencies::get_circular_dependencies()` and `WP_Plugin_Dependencies::check_for_circular_dependencies()` for cached results, acyclic dependencies, missing plugins, and dependency cycles. Developed in: WordPress/wordpress-develop#14584 Props huzaifaalmesbah. See #65819. Built from https://develop.svn.wordpress.org/trunk@64666 git-svn-id: http://core.svn.wordpress.org/trunk@63816 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Description
Adds tests for
WP_Plugin_Dependencies::get_circular_dependencies()andWP_Plugin_Dependencies::check_for_circular_dependencies(), which find plugins whose requirements form a loop. The existinghasCircularDependency.phptests only check whether a plugin has a circular dependency; the pairs and slugs that the methods store and the admin notice lists had no tests.The tests set the dependencies read from the plugin headers through the class's static properties, which the shared test case resets. They cover:
The loop cases assert the pairs in order, and the slugs as a set.
This is a test-only change; no production code is modified.
Testing Instructions
npm run test:php -- --filter Tests_Admin_WPPluginDependencies_GetCircularDependenciesnpm run test:php -- --filter Tests_Admin_WPPluginDependencies_GetCircularDependencies -c tests/phpunit/multisite.xmlnpm run test:php -- --filter Tests_Admin_WPPluginDependencies_GetCircularDependencies --order-by=randomnpm run test:php -- --group pluginsnode ./tools/local-env/scripts/docker.js run --rm php ./vendor/bin/phpcs tests/phpunit/tests/admin/plugin-dependencies/getCircularDependencies.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.