Changeset 52577 for trunk/tests/phpunit/tests/query/invalidQueries.php
- Timestamp:
- 01/14/2022 05:50:52 PM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/query/invalidQueries.php
r51568 r52577 92 92 93 93 $query = new WP_Query( array( 'post_type' => 'unregistered_cpt' ) ); 94 $posts = $query->get_posts();95 94 96 95 $this->assertStringContainsString( "{$wpdb->posts}.post_type = 'unregistered_cpt'", self::$last_posts_request ); 97 96 $this->assertStringContainsString( "{$wpdb->posts}.post_status = 'publish'", self::$last_posts_request ); 98 $this->assertCount( 0, $ posts );97 $this->assertCount( 0, $query->posts ); 99 98 } 100 99 … … 112 111 ) 113 112 ); 114 $posts = $query->get_posts();115 113 116 114 $this->assertStringContainsString( "{$wpdb->posts}.post_type = 'unregistered_cpt'", self::$last_posts_request ); 117 $this->assertCount( 1, $ posts, 'the valid `page` post type should still return one post' );115 $this->assertCount( 1, $query->posts, 'the valid `page` post type should still return one post' ); 118 116 } 119 117 … … 144 142 ) 145 143 ); 146 $posts = $query->get_posts();147 144 148 145 // Only the published page should be returned. 149 $this->assertCount( 1, $ posts );146 $this->assertCount( 1, $query->posts ); 150 147 } 151 148 … … 159 156 ) 160 157 ); 161 $posts = $query->get_posts();162 158 163 159 // Only the published post should be returned. 164 $this->assertCount( 1, $ posts );160 $this->assertCount( 1, $query->posts ); 165 161 } 166 162 }
Note: See TracChangeset
for help on using the changeset viewer.