Repository navigation
Tests: Add unit coverage for get_comment_author_url() and comment_author_url() - #15280
shail-mehta wants to merge 2 commits into
Conversation
Add unit tests for URL retrieval, empty fallback, filters, and display output.\n\nSee #65819.
There was a problem hiding this comment.
🟡 Changes recommended
The display test does not check the URL received by the comment_url callback, so incorrect URL forwarding by comment_author_url() would go undetected.
1 open issue
What changed in this PR
Adds dedicated PHPUnit coverage for WordPress’s comment-author URL helpers as part of the test cleanup tracked in #65819. No production code changes.
Changes:
- Covers URL retrieval by comment ID, comment object, and global fallback, including empty URLs.
- Tests retrieval filtering and filtered display output, with coverage annotations for both helpers.
| File | Description |
|---|---|
tests/phpunit/tests/comment/commentAuthorUrl.php |
Adds fixtures and six tests for get_comment_author_url() and comment_author_url(). |
Review effort: Balanced
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
|
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.
Current callback verifies the URL forwarded into the separate display filter. Existing getter test only checks comment ID forwarding, so this adds an output contract.
Local randomized single-site and multisite checks passed with related existing tests: 51 tests, 319 assertions across this five-PR batch (seed 15273). PHPCS passed.
Optional: Fold into existing getter class and consolidate ID/object/global variants. Do not add a URL edge matrix.
AI review · gpt-6
Verify comment email, URL, and ID retrieval and display, including global comment handling and filtered output. Developed in: #15274, #15276, #15280 Props shailu25. See #65819. git-svn-id: https://develop.svn.wordpress.org/trunk@65137 602fd350-edb4-49c9-b593-d223f7449a82
Verify comment email, URL, and ID retrieval and display, including global comment handling and filtered output. Developed in: WordPress/wordpress-develop#15274, WordPress/wordpress-develop#15276, WordPress/wordpress-develop#15280 Props shailu25. See #65819. Built from https://develop.svn.wordpress.org/trunk@65137 git-svn-id: http://core.svn.wordpress.org/trunk@64286 1a063a9b-81f0-0310-95a4-ce76da25c4cd
|
PR #15280 landed in https://core.trac.wordpress.org/changeset/65137 |

Trac ticket: #65819
What
Adds a dedicated PHPUnit class for
get_comment_author_url()andcomment_author_url(), covering URL retrieval, comment objects, the global comment fallback, empty URLs, filters, and display output.Test-only; no production code changes.
Why
These helpers lacked direct return-value coverage beyond a filter-argument check. Small helper coverage fits the #65819 test cleanup track.
How
Add
tests/phpunit/tests/comment/commentAuthorUrl.phpwith@coversfor both functions.Testing Instructions
npm run test:php -- --filter Tests_Comment_CommentAuthorUrlnpm run test:php -- --filter Tests_Comment_CommentAuthorUrl -c tests/phpunit/multisite.xmlnpm run test:php -- --filter Tests_Comment_CommentAuthorUrl --order-by=randomnpm run test:php -- --group commentUse of AI Tools