WordPress.org

Make WordPress Core

Ticket #35025: 35025-test.diff

File 35025-test.diff, 887 bytes (added by boonebgorges, 4 years ago)
  • tests/phpunit/tests/comment/query.php

    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 { 
    21922192                $found = wp_list_pluck( $q->comments, 'comment_ID' );
    21932193                $this->assertEqualSets( array( $c ), $found );
    21942194        }
     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        }
    21952216}