Repository navigation
Tests: Add unit coverage for get_self_link() - #15427
shail-mehta wants to merge 1 commit into
Conversation
Cover scheme-aware feed self URL construction from REQUEST_URI. See #65819.
There was a problem hiding this comment.
🟡 Changes recommended
The test exercises only HTTP and would still pass without set_url_scheme(), leaving scheme-aware behavior unprotected without explicit HTTP and HTTPS assertions.
1 open issue
What changed in this PR
Adds dedicated PHPUnit coverage for get_self_link(), the helper that constructs feed self URLs, as part of the #65819 test cleanup effort. No production code changes are included.
Changes:
- Adds a feed test class with
@covers ::get_self_link. - Checks URL construction from
REQUEST_URI, including a query string and the home URL’s host and optional port.
| File | Description |
|---|---|
tests/phpunit/tests/feed/getSelfLink.php |
Adds a direct test of feed self URL construction. |
Review effort: Balanced
| $this->assertSame( | ||
| set_url_scheme( 'http://' . $domain . '/feed/rss2/?foo=bar' ), | ||
| get_self_link() | ||
| ); |
|
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: #66480 |

Trac ticket: #66480
What
Adds a dedicated PHPUnit class for
get_self_link(), covering scheme-aware feed self URL construction fromREQUEST_URI.Test-only; no production code changes.
Why
get_self_link()had no direct@coverscoverage. It builds the Atom/RSS self link used by feed templates. Small helper coverage fits the #65819 test cleanup track.How
Add
tests/phpunit/tests/feed/getSelfLink.phpwith@covers ::get_self_link, setting$_SERVER['REQUEST_URI']and asserting the scheme-aware URL.Testing Instructions
docker compose up -d mysql docker compose run --rm php ./vendor/bin/phpunit --filter Tests_Feed_GetSelfLink ## Use of AI Tools - Cursor