Skip to content

Commit 1b1328f

Browse files
committed
Remove unused static class member variables and add types
1 parent 92710e7 commit 1b1328f

1 file changed

Lines changed: 12 additions & 24 deletions

File tree

tests/phpunit/tests/general/paginateLinks.php

Lines changed: 12 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -7,38 +7,26 @@
77
*/
88
class Tests_General_PaginateLinks extends WP_UnitTestCase {
99

10-
private $i18n_count = 0;
11-
12-
/**
13-
* Post IDs created for shared fixtures.
14-
*
15-
* @var int[]
16-
*/
17-
protected static $post_ids = array();
18-
19-
/**
20-
* Category ID created for shared fixtures.
21-
*
22-
* @var int
23-
*/
24-
protected static $category_id = 0;
10+
private int $i18n_count = 0;
2511

2612
/**
2713
* Set up shared fixtures.
2814
*
2915
* @param WP_UnitTest_Factory $factory Factory instance.
3016
*/
31-
public static function wpSetUpBeforeClass( $factory ) {
32-
self::$category_id = $factory->term->create(
17+
public static function wpSetUpBeforeClass( WP_UnitTest_Factory $factory ): void {
18+
$category_id = $factory->term->create(
3319
array(
3420
'taxonomy' => 'category',
3521
'name' => 'Categorized',
3622
)
3723
);
24+
assert( is_int( $category_id ) );
3825

39-
self::$post_ids = $factory->post->create_many( 10 );
40-
foreach ( self::$post_ids as $post_id ) {
41-
wp_set_post_categories( $post_id, array( self::$category_id ) );
26+
$post_ids = $factory->post->create_many( 10 );
27+
foreach ( $post_ids as $post_id ) {
28+
assert( is_int( $post_id ) );
29+
assert( is_array( wp_set_post_categories( $post_id, array( $category_id ) ) ) );
4230
}
4331
}
4432

@@ -422,7 +410,7 @@ public function test_custom_base_query_arg_should_be_stripped_from_current_url_b
422410
*
423411
* @ticket 61393
424412
*/
425-
public function test_permalinks_with_trailing_slash_produce_links_with_trailing_slashes() {
413+
public function test_permalinks_with_trailing_slash_produce_links_with_trailing_slashes(): void {
426414
update_option( 'posts_per_page', 2 );
427415
$this->set_permalink_structure( '/%postname%/' );
428416

@@ -446,7 +434,7 @@ public function test_permalinks_with_trailing_slash_produce_links_with_trailing_
446434
*
447435
* @ticket 61393
448436
*/
449-
public function test_permalinks_without_trailing_slash_produce_links_without_trailing_slashes() {
437+
public function test_permalinks_without_trailing_slash_produce_links_without_trailing_slashes(): void {
450438
update_option( 'posts_per_page', 2 );
451439
$this->set_permalink_structure( '/%postname%' );
452440

@@ -475,7 +463,7 @@ public function test_permalinks_without_trailing_slash_produce_links_without_tra
475463
*
476464
* @param string $query_string Query string.
477465
*/
478-
public function test_permalinks_with_trailing_slash_do_not_modify_query_strings( string $query_string ) {
466+
public function test_permalinks_with_trailing_slash_do_not_modify_query_strings( string $query_string ): void {
479467
update_option( 'posts_per_page', 2 );
480468
$this->set_permalink_structure( '/%postname%/' );
481469

@@ -504,7 +492,7 @@ public function test_permalinks_with_trailing_slash_do_not_modify_query_strings(
504492
*
505493
* @param string $query_string Query string.
506494
*/
507-
public function test_permalinks_without_trailing_slash_do_not_modify_query_strings( string $query_string ) {
495+
public function test_permalinks_without_trailing_slash_do_not_modify_query_strings( string $query_string ): void {
508496
update_option( 'posts_per_page', 2 );
509497
$this->set_permalink_structure( '/%postname%' );
510498

0 commit comments

Comments
 (0)