diff --git tests/phpunit/tests/comment/query.php tests/phpunit/tests/comment/query.php
index 5d250ea..6462645 100644
|
|
class Tests_Comment_Query extends WP_UnitTestCase { |
2192 | 2192 | $found = wp_list_pluck( $q->comments, 'comment_ID' ); |
2193 | 2193 | $this->assertEqualSets( array( $c ), $found ); |
2194 | 2194 | } |
| 2195 | |
| 2196 | /** |
| 2197 | * @ticket 35025 |
| 2198 | */ |
| 2199 | public function test_threaded_comment_query_should_prime_cache_get_children_cache() { |
| 2200 | global $wpdb; |
| 2201 | |
| 2202 | $comments = self::factory()->comment->create_many( 3, array( 'comment_post_ID' => $this->post_id ) ); |
| 2203 | |
| 2204 | $q = new WP_Comment_Query( array( |
| 2205 | 'hierarchical' => 'threaded', |
| 2206 | ) ); |
| 2207 | |
| 2208 | $num_queries = $wpdb->num_queries; |
| 2209 | |
| 2210 | foreach ( $q->comments as $c ) { |
| 2211 | $c->get_children(); |
| 2212 | } |
| 2213 | |
| 2214 | $this->assertSame( $num_queries, $wpdb->num_queries ); |
| 2215 | } |
2195 | 2216 | } |