Repository navigation
Tests: Cover the_posts_navigation() - #15321
devmuhib009 wants to merge 2 commits into
Conversation
|
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:
|
There was a problem hiding this comment.
🟡 Changes recommended
The pagination test hard-codes example.org in expected links, causing false failures when WP_TESTS_DOMAIN differs; expected URLs should use home_url() and esc_url().
1 open issue
What changed in this PR
This PR extends WordPress’s posts-navigation tests to verify that the_posts_navigation() echoes markup with custom arguments.
Changes:
- Adds an output assertion covering pagination links, a custom class, screen-reader text, and an ARIA label.
- Updates the test class documentation and coverage annotations to include
the_posts_navigation().
| File | Description |
|---|---|
tests/phpunit/tests/link/getThePostsNavigation.php |
Adds the navigation echo test and updates coverage annotations. |
Review effort: Balanced
| } | ||
| ); | ||
|
|
||
| $expected = '<nav class="echo-navigation" aria-label="Echo ARIA"><h2>Echo Reader</h2><div class="nav-previous"><a href="http://example.org/?paged=3" >Older posts</a></div><div class="nav-next"><a href="http://example.org/" >Newer posts</a></div></nav>'; |
huzaifaalmesbah
left a comment
There was a problem hiding this comment.
I left a few small notes inline.
AI Review: Opus 5.5
| } | ||
| ); | ||
|
|
||
| $expected = '<nav class="echo-navigation" aria-label="Echo ARIA"><h2>Echo Reader</h2><div class="nav-previous"><a href="http://example.org/?paged=3" >Older posts</a></div><div class="nav-next"><a href="http://example.org/" >Newer posts</a></div></nav>'; |
There was a problem hiding this comment.
Copilot flagged this too, and it is what fails in the two example.org:8889 jobs. home_url() works with both domains; I ran it locally with each:
| $expected = '<nav class="echo-navigation" aria-label="Echo ARIA"><h2>Echo Reader</h2><div class="nav-previous"><a href="http://example.org/?paged=3" >Older posts</a></div><div class="nav-next"><a href="http://example.org/" >Newer posts</a></div></nav>'; | |
| $expected = '<nav class="echo-navigation" aria-label="Echo ARIA"><h2>Echo Reader</h2><div class="nav-previous"><a href="' . home_url( '/?paged=3' ) . '" >Older posts</a></div><div class="nav-next"><a href="' . home_url( '/' ) . '" >Newer posts</a></div></nav>'; |
| * | ||
| * @ticket 65819 | ||
| * | ||
| * @covers ::the_posts_navigation |
There was a problem hiding this comment.
Optional: the class docblock already has @covers ::the_posts_navigation, and the other tests here don't repeat it. Feel free to drop this one.
lancewillett
left a comment
There was a problem hiding this comment.
Please derive the expected pagination URLs from the configured home URL and escape them as HTML URLs. The hard-coded http://example.org expectations reject a valid installation using another host or port. This confirms the existing inline feedback; the wrapper itself does not need changing.
AI review · gpt-6
…avigation() tests.

Trac ticket: https://core.trac.wordpress.org/ticket/65819
This PR extends
Tests_Link_GetThePostsNavigationto coverthe_posts_navigation()echoing the navigation markup with custom arguments.