diff --git a/tests/phpunit/tests/rest-api/rest-categories-controller.php b/tests/phpunit/tests/rest-api/rest-categories-controller.php index 01bddd3738..ef72b6f8fa 100644 --- a/tests/phpunit/tests/rest-api/rest-categories-controller.php +++ b/tests/phpunit/tests/rest-api/rest-categories-controller.php @@ -38,7 +38,7 @@ class WP_Test_REST_Categories_Controller extends WP_Test_REST_Controller_Testcas // Set up categories for pagination tests. for ( $i = 0; $i < self::$total_categories - 1; $i++ ) { - $category_ids[] = $factory->category->create( + self::$category_ids[] = $factory->category->create( array( 'name' => "Category {$i}", ) diff --git a/tests/phpunit/tests/rest-api/rest-comments-controller.php b/tests/phpunit/tests/rest-api/rest-comments-controller.php index 99986a8037..bf5d112d4e 100644 --- a/tests/phpunit/tests/rest-api/rest-comments-controller.php +++ b/tests/phpunit/tests/rest-api/rest-comments-controller.php @@ -117,7 +117,7 @@ class WP_Test_REST_Comments_Controller extends WP_Test_REST_Controller_Testcase // Set up comments for pagination tests. for ( $i = 0; $i < self::$total_comments - 1; $i++ ) { - $comment_ids[] = $factory->comment->create( + self::$comment_ids[] = $factory->comment->create( array( 'comment_content' => "Comment {$i}", 'comment_post_ID' => self::$post_id, diff --git a/tests/phpunit/tests/rest-api/rest-tags-controller.php b/tests/phpunit/tests/rest-api/rest-tags-controller.php index b9ac20cf71..788d6901f2 100644 --- a/tests/phpunit/tests/rest-api/rest-tags-controller.php +++ b/tests/phpunit/tests/rest-api/rest-tags-controller.php @@ -54,7 +54,7 @@ class WP_Test_REST_Tags_Controller extends WP_Test_REST_Controller_Testcase { // Set up tags for pagination tests. for ( $i = 0; $i < self::$total_tags; $i++ ) { - $tag_ids[] = $factory->tag->create( + self::$tag_ids[] = $factory->tag->create( array( 'name' => "Tag {$i}", ) @@ -412,6 +412,8 @@ class WP_Test_REST_Tags_Controller extends WP_Test_REST_Controller_Testcase { $response = rest_get_server()->dispatch( $request ); $tags = $response->get_data(); + $this->assertNotEmpty( $tags ); + $i = 0; foreach ( $tags as $tag ) { $this->assertSame( $tag['name'], "Tag {$i}" ); @@ -426,6 +428,8 @@ class WP_Test_REST_Tags_Controller extends WP_Test_REST_Controller_Testcase { $response = rest_get_server()->dispatch( $request ); $tags = $response->get_data(); + $this->assertNotEmpty( $tags ); + foreach ( $tags as $tag ) { $this->assertSame( $tag['name'], "Tag {$i}" ); $i++;