Skip to content

Commit c9a244b

Browse files
committed
Remove redundant assertion and assert a specific number of found links
1 parent 3f8302c commit c9a244b

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

tests/phpunit/tests/general/paginateLinks.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -462,7 +462,9 @@ public function test_plain_permalinks_are_not_modified_with_trailing_slash(): vo
462462
update_option( 'posts_per_page', 2 );
463463
$this->set_permalink_structure( '' );
464464

465-
$category_id = get_category_by_slug( 'categorized' )->term_id;
465+
$term = get_category_by_slug( 'categorized' );
466+
$this->assertInstanceOf( WP_Term::class, $term );
467+
$category_id = $term->term_id;
466468
$this->go_to( "/?cat={$category_id}&paged=2" );
467469

468470
// `current` needs to be passed as it's not picked up from the query vars set by `go_to()` above.
@@ -483,10 +485,9 @@ public function test_plain_permalinks_are_not_modified_with_trailing_slash(): vo
483485
$expected_link = $expected_links[ $found_links ] ?? '';
484486
++$found_links;
485487
$href = (string) $processor->get_attribute( 'href' );
486-
$this->assertStringStartsWith( trailingslashit( home_url() ), $href, 'Pagination links should contain the home URL followed by a trailing slash, found: ' . $href );
487488
$this->assertSame( $expected_link, $href, "Pagination links should include the category query string, found: $href" );
488489
}
489-
$this->assertGreaterThan( 0, $found_links, 'There should be pagination links found.' );
490+
$this->assertSame( count( $expected_links ), $found_links, 'There should be this number of pagination links found.' );
490491
}
491492

492493
/**

0 commit comments

Comments
 (0)