From a42a7970d9d8a7d2828da88dfa173dd0f02bc751 Mon Sep 17 00:00:00 2001 From: Boone Gorges Date: Sun, 30 Jul 2017 14:42:56 +0000 Subject: [PATCH] Ensure that an assertion takes place in `Tests_Comment_Query::test_comment_query_should_be_cached()`. Missed during [37608]. See #36906. Fixes #41357. git-svn-id: https://develop.svn.wordpress.org/trunk@41188 602fd350-edb4-49c9-b593-d223f7449a82 --- tests/phpunit/tests/comment/query.php | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/tests/phpunit/tests/comment/query.php b/tests/phpunit/tests/comment/query.php index ff4e3aced3..60e111d544 100644 --- a/tests/phpunit/tests/comment/query.php +++ b/tests/phpunit/tests/comment/query.php @@ -2662,18 +2662,25 @@ class Tests_Comment_Query extends WP_UnitTestCase { public function test_comment_query_should_be_cached() { global $wpdb; - $q = new WP_Comment_Query( array( - 'post_id' => self::$post_id, - 'fields' => 'ids', - ) ); - $c = wp_insert_comment( array( 'comment_author' => 'Foo', 'comment_author_email' => 'foo@example.com', 'comment_post_ID' => self::$post_id, ) ); + $q = new WP_Comment_Query( array( + 'post_id' => self::$post_id, + 'fields' => 'ids', + ) ); + $num_queries = $wpdb->num_queries; + + $q2 = new WP_Comment_Query( array( + 'post_id' => self::$post_id, + 'fields' => 'ids', + ) ); + + $this->assertSame( $num_queries, $wpdb->num_queries ); } public function test_created_comment_should_invalidate_query_cache() {