Repository navigation
Tests: Add unit coverage for get_comment_author_url() and comment_author_url() - #15280
Draft
shail-mehta wants to merge 2 commits into
Draft
shail-mehta wants to merge 2 commits into
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

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