Changeset 37625 for trunk/tests/phpunit/tests/comment/query.php
- Timestamp:
- 06/02/2016 06:27:43 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/comment/query.php
r37608 r37625 2431 2431 return $clauses; 2432 2432 } 2433 2434 /** 2435 * @ticket 36487 2436 */ 2437 public function test_cache_should_be_hit_when_querying_descendants() { 2438 global $wpdb; 2439 2440 $p = self::factory()->post->create(); 2441 $comment_1 = self::factory()->comment->create( array( 2442 'comment_post_ID' => $p, 2443 'comment_approved' => '1', 2444 ) ); 2445 $comment_2 = self::factory()->comment->create( array( 2446 'comment_post_ID' => $p, 2447 'comment_approved' => '1', 2448 'comment_parent' => $comment_1, 2449 ) ); 2450 $comment_3 = self::factory()->comment->create( array( 2451 'comment_post_ID' => $p, 2452 'comment_approved' => '1', 2453 'comment_parent' => $comment_1, 2454 ) ); 2455 $comment_4 = self::factory()->comment->create( array( 2456 'comment_post_ID' => $p, 2457 'comment_approved' => '1', 2458 'comment_parent' => $comment_2, 2459 ) ); 2460 2461 $q1 = new WP_Comment_Query( array( 2462 'post_id' => $p, 2463 'hierarchical' => true, 2464 ) ); 2465 $q1_ids = wp_list_pluck( $q1->comments, 'comment_ID' ); 2466 2467 $num_queries = $wpdb->num_queries; 2468 $q2 = new WP_Comment_Query( array( 2469 'post_id' => $p, 2470 'hierarchical' => true, 2471 ) ); 2472 $q2_ids = wp_list_pluck( $q2->comments, 'comment_ID' ); 2473 2474 $this->assertEqualSets( $q1_ids, $q2_ids ); 2475 $this->assertSame( $num_queries, $wpdb->num_queries ); 2476 } 2477 2433 2478 /** 2434 2479 * @ticket 27571
Note: See TracChangeset
for help on using the changeset viewer.