Repository navigation
Tests: Add unit coverage for rest_get_queried_resource_route() - #15291
shail-mehta wants to merge 2 commits into
Conversation
Add unit tests for queried post, term, and author REST routes, empty fallback, and filter overrides. See #65819.
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues block the test-only addition of direct PHPUnit coverage for rest_get_queried_resource_route().
No open issues 🎉
What changed in this PR
Adds direct PHPUnit coverage for rest_get_queried_resource_route() as part of the #65819 test cleanup effort. This is a test-only change; production code is unchanged.
Changes:
- Tests routes for singular posts, category archives, and author archives.
- Checks the empty-string fallback when no resource is identified.
- Verifies filter overrides and the original route passed to the filter.
| File | Description |
|---|---|
tests/phpunit/tests/rest-api/restGetQueriedResourceRoute.php |
Adds a dedicated test class with five cases and an explicit @covers annotation. |
Review effort: Balanced
|
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:
|
lancewillett
left a comment
There was a problem hiding this comment.
Exercises query-to-REST-route selection for post, category, author and no-resource branches; these are not duplicates of direct route-builder tests.
Local randomized single-site and multisite checks passed alongside related existing tests; PHPCS passed.
Optional: No additional taxonomy/archive matrix needed; five methods cover the branches without per-taxonomy clones.
AI review · gpt-6
Verify `rest_get_queried_resource_route()` identifies singular posts, categories, and authors, handles requests without a resource, and respects its filter. Developed in: #15291 Props shailu25. See #65819. git-svn-id: https://develop.svn.wordpress.org/trunk@65142 602fd350-edb4-49c9-b593-d223f7449a82
Verify `rest_get_queried_resource_route()` identifies singular posts, categories, and authors, handles requests without a resource, and respects its filter. Developed in: WordPress/wordpress-develop#15291 Props shailu25. See #65819. Built from https://develop.svn.wordpress.org/trunk@65142 git-svn-id: http://core.svn.wordpress.org/trunk@64291 1a063a9b-81f0-0310-95a4-ce76da25c4cd
|
PR #15291 landed in https://core.trac.wordpress.org/changeset/65142 |
Trac ticket: #65819
What
Adds a dedicated PHPUnit class for
rest_get_queried_resource_route(), covering singular posts, category archives, author archives, the empty fallback, and filter overrides.Test-only; no production code changes.
Why
rest_get_queried_resource_route()had no direct@coverscoverage. Small helper coverage fits the #65819 test cleanup track.How
Add
tests/phpunit/tests/rest-api/restGetQueriedResourceRoute.phpwith@covers ::rest_get_queried_resource_route.rest_queried_resource_routeto replace the route and asserts the original argumentTesting Instructions
npm run test:php -- --filter Tests_REST_API_RestGetQueriedResourceRoutenpm run test:php -- --filter Tests_REST_API_RestGetQueriedResourceRoute -c tests/phpunit/multisite.xmlnpm run test:php -- --filter Tests_REST_API_RestGetQueriedResourceRoute --order-by=randomnpm run test:php -- --group restapiUse of AI Tools