Changeset 54352 for trunk/tests/phpunit/tests/query/cacheResults.php
- Timestamp:
- 09/29/2022 10:07:34 AM (3 years ago)
- File:
-
- 1 edited
-
trunk/tests/phpunit/tests/query/cacheResults.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/query/cacheResults.php
r54111 r54352 985 985 $this->assertNotSame( $num_queries, get_num_queries(), 'Removing term does not invalidate previous cache.' ); 986 986 } 987 988 /** 989 * @ticket 22176 990 * @dataProvider data_query_cache_with_empty_result_set 991 */ 992 public function test_query_cache_with_empty_result_set( $fields_q1, $fields_q2 ) { 993 _delete_all_posts(); 994 995 $args_q1 = array( 996 'fields' => $fields_q1, 997 ); 998 999 $query_1 = new WP_Query(); 1000 $posts_q1 = $query_1->query( $args_q1 ); 1001 $this->assertEmpty( $posts_q1, 'First query does not return an empty result set.' ); 1002 1003 $args_q2 = array( 1004 'fields' => $fields_q2, 1005 ); 1006 1007 $num_queries = get_num_queries(); 1008 $query_2 = new WP_Query(); 1009 $posts_q2 = $query_2->query( $args_q2 ); 1010 $this->assertEmpty( $posts_q2, 'Second query does not return an empty result set.' ); 1011 $this->assertSame( $num_queries, get_num_queries(), 'Second query is not cached.' ); 1012 } 1013 1014 public function data_query_cache_with_empty_result_set() { 1015 return array( 1016 array( '', '' ), 1017 array( '', 'ids' ), 1018 array( '', 'id=>parent' ), 1019 1020 array( 'ids', '' ), 1021 array( 'ids', 'ids' ), 1022 array( 'ids', 'id=>parent' ), 1023 1024 array( 'id=>parent', '' ), 1025 array( 'id=>parent', 'ids' ), 1026 array( 'id=>parent', 'id=>parent' ), 1027 ); 1028 } 987 1029 }
Note: See TracChangeset
for help on using the changeset viewer.