From 422fee0bc003a597697f5328c61b335159687472 Mon Sep 17 00:00:00 2001 From: Muhibul Haque Date: Sun, 1 Nov 2026 16:41:35 +0600 Subject: [PATCH 1/2] Tests: Cover the_posts_navigation(). See #65819. Props devmuhib009. --- .../tests/link/getThePostsNavigation.php | 44 ++++++++++++++++++- 1 file changed, 43 insertions(+), 1 deletion(-) diff --git a/tests/phpunit/tests/link/getThePostsNavigation.php b/tests/phpunit/tests/link/getThePostsNavigation.php index 0cb39b07453ee..4357d31062452 100644 --- a/tests/phpunit/tests/link/getThePostsNavigation.php +++ b/tests/phpunit/tests/link/getThePostsNavigation.php @@ -1,13 +1,14 @@ set_permalink_structure( '' ); + $this->go_to( home_url( '/' ) ); + + global $wp_query, $paged; + + $paged = 2; + $wp_query = new WP_Query( + array( + 'post_type' => 'post', + 'posts_per_page' => 1, + 'paged' => $paged, + ) + ); + + add_filter( + 'navigation_markup_template', + static function () { + return ''; + } + ); + + $expected = ''; + + $this->expectOutputString( $expected ); + the_posts_navigation( + array( + 'class' => 'echo-navigation', + 'screen_reader_text' => 'Echo Reader', + 'aria_label' => 'Echo ARIA', + ) + ); + } } From aa9f085ebcff6127d7810cc2eeccf19597137da5 Mon Sep 17 00:00:00 2001 From: Muhibul Haque Date: Mon, 2 Nov 2026 15:20:06 +0600 Subject: [PATCH 2/2] Tests: Derive expected pagination URLs from home_url() in the_posts_navigation() tests. --- tests/phpunit/tests/link/getThePostsNavigation.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/tests/phpunit/tests/link/getThePostsNavigation.php b/tests/phpunit/tests/link/getThePostsNavigation.php index 4357d31062452..f3e1077e81015 100644 --- a/tests/phpunit/tests/link/getThePostsNavigation.php +++ b/tests/phpunit/tests/link/getThePostsNavigation.php @@ -110,8 +110,6 @@ public static function data_get_the_posts_navigation() { * Tests that the_posts_navigation() echoes the navigation markup. * * @ticket 65819 - * - * @covers ::the_posts_navigation */ public function test_the_posts_navigation_echoes() { $this->set_permalink_structure( '' ); @@ -135,7 +133,7 @@ static function () { } ); - $expected = ''; + $expected = ''; $this->expectOutputString( $expected ); the_posts_navigation(