Skip to content

Tests: Add unit test coverage for the_feed_link() and post_comments_feed_link() - #14493

Closed
rejaulalomkhan wants to merge 1 commit into
WordPress:trunkfrom
rejaulalomkhan:tests/feed-links
Closed

rejaulalomkhan wants to merge 1 commit into
WordPress:trunkfrom
rejaulalomkhan:tests/feed-links

Conversation

@rejaulalomkhan

Copy link
Copy Markdown

Description

Adds dedicated unit test coverage for the_feed_link() and post_comments_feed_link() in tests/phpunit/tests/link/theFeedLink.php and tests/phpunit/tests/link/postCommentsFeedLink.php.

The tests cover:

  • the_feed_link():
    • Generates correct feed anchor markup for plain permastructs with default feed type.
    • Generates correct feed anchor markup for pretty permastructs (/%year%/%monthnum%/%day%/%postname%/).
    • Supports custom feed types (e.g. atom).
    • Applies and respects the the_feed_link filter hook.
  • post_comments_feed_link():
    • Outputs correct default link text (Comments Feed) and URL for posts on plain permalinks.
    • Supports custom link text (e.g. Subscribe via RSS).
    • Generates correct comments feed URLs on pretty permalinks.
    • Falls back to the global $post when $post_id is 0.
    • Supports custom feed types (e.g. atom).
    • Applies and respects the post_comments_feed_link_html filter hook.

This is a test-only change; no production code is modified.

Testing Instructions

  1. Run single-site tests:
    npm run test:php -- --filter "Tests_Link_TheFeedLink|Tests_Link_PostCommentsFeedLink"
  2. Run multisite tests:
    npm run test:php -- -c tests/phpunit/multisite.xml --filter "Tests_Link_TheFeedLink|Tests_Link_PostCommentsFeedLink"
  3. Run link group tests:
    npm run test:php -- --group link

Trac ticket: https://core.trac.wordpress.org/ticket/65819

Use of AI Tools

AI assistance: Yes
Tool(s): Antigravity
Model(s): Antigravity Agent
Used for: Drafting the tests and running technical verification checks (single-site, multisite, random-order, link group, PHPCS, mutation tests). I reviewed the changes, ran the tests locally, and take responsibility for them.


This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.

…eed_link()

Adds dedicated PHPUnit test coverage for the_feed_link() and post_comments_feed_link() in tests/phpunit/tests/link/.

See #65819.
@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. You can also manually ask me to refresh this list by adding the props-bot label.

Core Committers: Use this line as a base for the props when committing in SVN:

Props rejaulalomkhan.

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

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

Static review found no blocking issues in these test-only additions; tests were not executed during this review.

No open issues 🎉

What changed in this PR

Adds dedicated unit tests for WordPress feed-link output functions without changing production code.

Changes:

  • Covers default and custom feeds with plain and pretty permalinks.
  • Verifies link text, global post fallback, and output filters.
File Description
tests/​phpunit/​tests/​link/​theFeedLink.php Tests feed anchor markup, URLs, feed types, and filtering.
tests/​phpunit/​tests/​link/​postCommentsFeedLink.php Tests comment feed links, custom text, post fallback, and filtering.

Review effort: Balanced

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

Static review found no blocking issues in these test-only changes; tests were not executed during review.

No open issues 🎉

Review effort: Balanced

@lancewillett lancewillett left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The feed-link output and filter cases look correct.

Unit-tests audit complete. The batch passed randomized single-site and multisite runs, individual PR suites, and PHPCS. Three existing image-format cases were skipped; the changed image assertions executed successfully.

Optional, non-blocking: assert the full filtered anchor in the two output-filter tests, instead of only its prefix and suffix. This would strengthen the existing checks without adding more cases.

AI review · gpt-6

wporg-sync pushed a commit that referenced this pull request Oct 19, 2026
Cover `the_feed_link()` and `post_comments_feed_link()` output, feed arguments, permalink formats, and filters.

Developed in: #14493

Props rejaulalomkhan.
See #65819.


git-svn-id: https://develop.svn.wordpress.org/trunk@64573 602fd350-edb4-49c9-b593-d223f7449a82
@lancewillett

Copy link
Copy Markdown
Member

wporg-sync pushed a commit to WordPress/WordPress that referenced this pull request Oct 19, 2026
Cover `the_feed_link()` and `post_comments_feed_link()` output, feed arguments, permalink formats, and filters.

Developed in: WordPress/wordpress-develop#14493

Props rejaulalomkhan.
See #65819.

Built from https://develop.svn.wordpress.org/trunk@64573


git-svn-id: http://core.svn.wordpress.org/trunk@63723 1a063a9b-81f0-0310-95a4-ce76da25c4cd
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.

3 participants