Skip to content

Tests: Add unit coverage for get_comment_author_url() and comment_author_url() - #15280

Open
shail-mehta wants to merge 2 commits into
WordPress:trunkfrom
shail-mehta:tests/comment-author-url-65819
Open

shail-mehta wants to merge 2 commits into
WordPress:trunkfrom
shail-mehta:tests/comment-author-url-65819

Conversation

@shail-mehta

Copy link
Copy Markdown
Member

Trac ticket: #65819

What

Adds a dedicated PHPUnit class for get_comment_author_url() and comment_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.php with @covers for both functions.

Testing Instructions

  1. npm run test:php -- --filter Tests_Comment_CommentAuthorUrl
  2. npm run test:php -- --filter Tests_Comment_CommentAuthorUrl -c tests/phpunit/multisite.xml
  3. npm run test:php -- --filter Tests_Comment_CommentAuthorUrl --order-by=random
  4. npm run test:php -- --group comment

Use of AI Tools

  • Cursor

Add unit tests for URL retrieval, empty fallback, filters, and display output.\n\nSee #65819.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 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>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No active review issues are reported for the test-only additions covering the comment author URL helpers.

No open issues 🎉

1 resolved since last review

Review effort: Balanced

@shail-mehta
shail-mehta marked this pull request as ready for review October 31, 2026 17:27
@github-actions

Copy link
Copy Markdown

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:

Props shailu25.

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.


Props Bot commands

You can trigger Props Bot actions by commenting on this PR:

  • @propsbot add <username> to give props to a GitHub user. Requires write access.
  • @propsbot remove <username> to leave a user out of the props. Requires write access.
  • @propsbot refresh to refresh this list. Adding the props-bot label works too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants