Repository navigation
Tests: Add unit coverage for get_wp_title_rss() - #15370
shail-mehta wants to merge 3 commits into
Conversation
Cover the get_wp_title_rss filter arguments with a fixed document title. See #65819.
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues are identified for the test-only addition covering the get_wp_title_rss() filter contract.
No open issues 🎉
What changed in this PR
Adds direct PHPUnit coverage for get_wp_title_rss(), checking its filter contract without duplicating document-title composition tests. No production code changes.
Changes:
- Adds a dedicated test class with
@covers ::get_wp_title_rss. - Uses a fixed document title and verifies the filtered result, filter call count, and both filter arguments.
| File | Description |
|---|---|
tests/phpunit/tests/feed/getWpTitleRss.php |
Adds a test for the feed-title filter’s arguments and returned value. |
Review effort: Balanced
|
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:
|
lancewillett
left a comment
There was a problem hiding this comment.
The filtered-title result assertion protects useful behavior. Please keep that assertion and simplify the test by replacing the MockAction with a small callback, removing the call-count and default deprecated-argument assertions. The changed output already proves the filter ran; the unused default argument adds no demonstrated consumer protection here.
One method and one literal output assertion are enough. Targeted single-site/multisite runs and PHPCS pass.
AI review · gpt-6
| add_filter( | ||
| 'get_wp_title_rss', | ||
| static function ( $title ) { | ||
| return $title . ' Custom'; | ||
| } | ||
| ); | ||
|
|
||
| $this->assertSame( 'Feed Title Custom', get_wp_title_rss() ); |
lancewillett
left a comment
There was a problem hiding this comment.
Approved at c513488. The test now checks the customized title, as requested. Mutation check: discarding the filter result is caught. On Copilot's thread: the deprecated argument and call count were dropped on purpose in the earlier review, so no change is needed.
1 test, 1 assertion in random order, single site and multisite. PHPCS clean. CI green.
AI review · claude-opus-5-5
|
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: #66474 |
Add a test that a callback on the `get_wp_title_rss` filter receives the document title and can change the feed title that `get_wp_title_rss()` returns. Developed in: #15370 Props shailu25. Fixes #66474. git-svn-id: https://develop.svn.wordpress.org/trunk@65257 602fd350-edb4-49c9-b593-d223f7449a82
Add a test that a callback on the `get_wp_title_rss` filter receives the document title and can change the feed title that `get_wp_title_rss()` returns. Developed in: WordPress/wordpress-develop#15370 Props shailu25. Fixes #66474. Built from https://develop.svn.wordpress.org/trunk@65257 git-svn-id: http://core.svn.wordpress.org/trunk@64406 1a063a9b-81f0-0310-95a4-ce76da25c4cd

Trac ticket: #66474
What
Adds a dedicated PHPUnit class for
get_wp_title_rss(), covering theget_wp_title_rssfilter arguments with a fixed document title.Test-only; no production code changes.
Why
get_wp_title_rss()had no direct@coverscoverage. Document title composition is already covered bywp_get_document_title()tests; this keeps the feed-title filter contract.How
Add
tests/phpunit/tests/feed/getWpTitleRss.phpwith@covers ::get_wp_title_rss, usingpre_get_document_titlefor a stable title and asserting filter call count and arguments.Testing Instructions
Expected: OK (1 test, 3 assertions).
Use of AI Tools