Changeset 37692 for trunk/tests/phpunit/tests/post/query.php
- Timestamp:
- 06/14/2016 01:59:25 AM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/post/query.php
r37225 r37692 389 389 $this->assertEqualSets( $requested, $actual_posts ); 390 390 } 391 392 /** 393 * @ticket 36687 394 */ 395 public function test_posts_pre_query_filter_should_bypass_database_query() { 396 global $wpdb; 397 398 add_filter( 'posts_pre_query', array( __CLASS__, 'filter_posts_pre_query' ) ); 399 400 $num_queries = $wpdb->num_queries; 401 $q = new WP_Query( array( 402 'fields' => 'ids', 403 'no_found_rows' => true, 404 ) ); 405 406 remove_filter( 'posts_pre_query', array( __CLASS__, 'filter_posts_pre_query' ) ); 407 408 $this->assertSame( $num_queries, $wpdb->num_queries ); 409 $this->assertSame( array( 12345 ), $q->posts ); 410 } 411 412 public static function filter_posts_pre_query( $posts ) { 413 return array( 12345 ); 414 } 391 415 }
Note: See TracChangeset
for help on using the changeset viewer.