Repository navigation
Tests: Add unit coverage for rest_output_link_wp_head() - #15282
shail-mehta wants to merge 1 commit into
Conversation
Add unit tests for REST API head link output and empty REST URL handling. See #65819.
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues are reported for the test-only change adding coverage of REST API discovery link output and the empty-URL case.
No open issues 🎉
What changed in this PR
Adds direct PHPUnit coverage for rest_output_link_wp_head() as part of the #65819 test cleanup effort. No production code changes.
Changes:
- Adds a dedicated test class with
@covers ::rest_output_link_wp_head. - Checks the REST API discovery link output.
- Checks that filtering the REST URL to an empty string produces no output.
| File | Description |
|---|---|
tests/phpunit/tests/rest-api/restOutputLinkWpHead.php |
Adds tests for REST discovery link output and the empty-URL early return. |
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.
Asserts the externally emitted REST discovery link and suppression when REST URL is disabled; no existing direct test found.
Local randomized single-site and multisite checks passed alongside related existing tests; PHPCS passed.
Optional: Expected URL derives from environment; acceptable for site-dependent base URL, but this does not independently test URL escaping. No additional edge matrix requested.
AI review · gpt-6
Verify the REST discovery link, RSD API element, and HTTP link header use the configured REST URL and are suppressed when that URL is disabled. Developed in: #15282, #15283, #15284 Props shailu25. See #65819. git-svn-id: https://develop.svn.wordpress.org/trunk@65140 602fd350-edb4-49c9-b593-d223f7449a82
Verify the REST discovery link, RSD API element, and HTTP link header use the configured REST URL and are suppressed when that URL is disabled. Developed in: WordPress/wordpress-develop#15282, WordPress/wordpress-develop#15283, WordPress/wordpress-develop#15284 Props shailu25. See #65819. Built from https://develop.svn.wordpress.org/trunk@65140 git-svn-id: http://core.svn.wordpress.org/trunk@64289 1a063a9b-81f0-0310-95a4-ce76da25c4cd
|
PR #15282 landed in https://core.trac.wordpress.org/changeset/65140 |
Trac ticket: #65819
What
Adds a dedicated PHPUnit class for
rest_output_link_wp_head(), covering the REST API<link>tag output and the empty REST URL early return.Test-only; no production code changes.
Why
rest_output_link_wp_head()had no direct@coverscoverage. Small helper coverage fits the #65819 test cleanup track.How
Add
tests/phpunit/tests/rest-api/restOutputLinkWpHead.phpwith@covers ::rest_output_link_wp_head.https://api.w.org/link for the REST rootrest_urlis filtered to an empty stringTesting Instructions
npm run test:php -- --filter Tests_REST_API_RestOutputLinkWpHeadnpm run test:php -- --filter Tests_REST_API_RestOutputLinkWpHead -c tests/phpunit/multisite.xmlnpm run test:php -- --filter Tests_REST_API_RestOutputLinkWpHead --order-by=randomnpm run test:php -- --group restapiUse of AI Tools