Skip to content

Tests: Add unit test coverage for search feed links - #14519

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

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

Conversation

@rejaulalomkhan

Copy link
Copy Markdown

Description

Adds a test class for get_search_feed_link() and get_search_comments_feed_link(), which had no tests.

The tests cover:

  • Plain and pretty permalinks, with the default feed and an explicit atom feed, and a query with spaces.
  • The comments feed: feed=comments-<type> with plain permalinks and ?withcomments=1 with pretty permalinks.
  • The default_feed filter being used when no feed type is passed.
  • The search_feed_link filter: its arguments ($link, $feed, 'posts') and filtered return value for the posts feed, and for the comments feed the two calls it makes (first 'posts' for the link it builds on, then 'comments') with the filtered return value.

Each behaviour was checked against a mutated source (default feed ignored, missing trailing slash, wrong search type, missing comments- prefix, missing withcomments, filter result discarded); a test fails for every mutation.

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

Testing Instructions

  1. npm run test:php -- --filter Tests_Link_GetSearchFeedLink
  2. npm run test:php -- -c tests/phpunit/multisite.xml --filter Tests_Link_GetSearchFeedLink
  3. npm run test:php -- --group link,feed

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

Use of AI Tools

AI assistance: Yes
Tool(s): Claude Code
Model(s): Claude Opus 5.5
Used for: Drafting the tests and running the checks. 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.

Covers get_search_feed_link() and get_search_comments_feed_link() with plain and pretty permalinks, explicit and default feed types, the default_feed filter, and the search_feed_link filter arguments and return value for both the posts and comments feeds.

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.

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.

1 participant