diff --git a/tests/phpunit/tests/query/invalidQueries.php b/tests/phpunit/tests/query/invalidQueries.php index ea18617b28..4c0b631f80 100644 --- a/tests/phpunit/tests/query/invalidQueries.php +++ b/tests/phpunit/tests/query/invalidQueries.php @@ -91,11 +91,10 @@ class Tests_Query_InvalidQueries extends WP_UnitTestCase { global $wpdb; $query = new WP_Query( array( 'post_type' => 'unregistered_cpt' ) ); - $posts = $query->get_posts(); $this->assertStringContainsString( "{$wpdb->posts}.post_type = 'unregistered_cpt'", self::$last_posts_request ); $this->assertStringContainsString( "{$wpdb->posts}.post_status = 'publish'", self::$last_posts_request ); - $this->assertCount( 0, $posts ); + $this->assertCount( 0, $query->posts ); } /** @@ -111,10 +110,9 @@ class Tests_Query_InvalidQueries extends WP_UnitTestCase { 'post_type' => array( 'unregistered_cpt', 'page' ), ) ); - $posts = $query->get_posts(); $this->assertStringContainsString( "{$wpdb->posts}.post_type = 'unregistered_cpt'", self::$last_posts_request ); - $this->assertCount( 1, $posts, 'the valid `page` post type should still return one post' ); + $this->assertCount( 1, $query->posts, 'the valid `page` post type should still return one post' ); } /** @@ -143,10 +141,9 @@ class Tests_Query_InvalidQueries extends WP_UnitTestCase { 'post_type' => 'page', ) ); - $posts = $query->get_posts(); // Only the published page should be returned. - $this->assertCount( 1, $posts ); + $this->assertCount( 1, $query->posts ); } /** @@ -158,9 +155,8 @@ class Tests_Query_InvalidQueries extends WP_UnitTestCase { 'static' => 'a', ) ); - $posts = $query->get_posts(); // Only the published post should be returned. - $this->assertCount( 1, $posts ); + $this->assertCount( 1, $query->posts ); } } diff --git a/tests/phpunit/tests/query/taxQuery.php b/tests/phpunit/tests/query/taxQuery.php index 2094262e24..c44f19880f 100644 --- a/tests/phpunit/tests/query/taxQuery.php +++ b/tests/phpunit/tests/query/taxQuery.php @@ -1024,8 +1024,7 @@ class Tests_Query_TaxQuery extends WP_UnitTestCase { ) ); - $posts = $query->get_posts(); - $this->assertCount( 0, $posts ); + $this->assertCount( 0, $query->posts ); } /** @@ -1059,8 +1058,7 @@ class Tests_Query_TaxQuery extends WP_UnitTestCase { ) ); - $posts = $query->get_posts(); - $this->assertCount( 0, $posts ); + $this->assertCount( 0, $query->posts ); } public function test_tax_query_include_children() {