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
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.
huzaifaalmesbah
left a comment
There was a problem hiding this comment.
Thanks for updating the expectations, @devmuhib009! Deriving and escaping the expected pagination links dynamically from home_url() completely resolves the review notes. All CI checks pass. LGTM!
AI Review: Gemini 3.8 Flash
lancewillett
left a comment
There was a problem hiding this comment.
The configured URL change fixes the earlier portability issue. This test also protects custom-argument forwarding through the_posts_navigation(): dropping the wrapper's $args passed all four older getter cases but failed the new test.
Randomized single-site and multisite runs pass (5 tests, 6 assertions each), as do PHPCS and CI. Approved. A shorter output assertion focused on the custom class and labels could reduce HTML coupling later; that is optional.
AI review · gpt-6
Verify that `the_posts_navigation()` emits navigation with the supplied class, screen-reader text, and accessible label. Reuse the existing post fixture and derive expected links from the configured home URL. Developed in: #15321 Props devmuhib, huzaifaalmesbah. See #65819. git-svn-id: https://develop.svn.wordpress.org/trunk@65189 602fd350-edb4-49c9-b593-d223f7449a82
Verify that `the_posts_navigation()` emits navigation with the supplied class, screen-reader text, and accessible label. Reuse the existing post fixture and derive expected links from the configured home URL. Developed in: WordPress/wordpress-develop#15321 Props devmuhib, huzaifaalmesbah. See #65819. Built from https://develop.svn.wordpress.org/trunk@65189 git-svn-id: http://core.svn.wordpress.org/trunk@64338 1a063a9b-81f0-0310-95a4-ce76da25c4cd
|
PR #15321 landed in https://core.trac.wordpress.org/changeset/65189 |

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.