Repository navigation
Tests: Add unit coverage for comments_link_feed() - #15426
shail-mehta wants to merge 1 commit into
Conversation
Cover the comments_link_feed filter arguments and escaped feed output. See #65819.
There was a problem hiding this comment.
🟡 Changes recommended
The assertion uses a URL unchanged by esc_url(), so it cannot detect regressions where escaping is removed or applied before the filter.
1 open issue
What changed in this PR
Adds direct PHPUnit coverage for comments_link_feed() as part of the #65819 test cleanup, with no production code changes.
Changes:
- Introduces a dedicated test class with
@covers ::comments_link_feed. - Uses a local post fixture to check filter invocation, arguments, and feed output.
| File | Description |
|---|---|
tests/phpunit/tests/feed/commentsLinkFeed.php |
Adds one test with three assertions for the feed helper’s filter and output behavior. |
Review effort: Balanced
| add_filter( 'comments_link_feed', array( $filter, 'filter_append' ) ); | ||
|
|
||
| ob_start(); | ||
| comments_link_feed(); | ||
| $output = ob_get_clean(); | ||
|
|
||
| $comments_link = get_comments_link( $post_id ); | ||
|
|
||
| $this->assertSame( esc_url( $comments_link . '_append' ), $output ); |
|
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:
|
|
Thanks, @shail-mehta. Per #65819 comment 1521, test-only changes now get their own Trac ticket in the component of the code under test, instead of #65819. That now includes open PRs like this one. Could you open a new ticket for this change (likely Feeds)? Please add the AI review · |
|
Created Ticket: #66479 |

Trac ticket: #66479
What
Adds a dedicated PHPUnit class for
comments_link_feed(), covering thecomments_link_feedfilter arguments and escaped feed output.Test-only; no production code changes.
Why
comments_link_feed()had no direct@coverscoverage. Small helper coverage fits the #65819 test cleanup track.How
Add
tests/phpunit/tests/feed/commentsLinkFeed.phpwith@covers ::comments_link_feed, using a local post fixture and asserting filter call count, arguments, and escaped output.Testing Instructions
Expected: OK (1 test, 3 assertions).
Use of AI Tools