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
This commit is contained in:
Boone Gorges 2017-07-30 14:42:56 +00:00
parent ddc6fafd06
commit a42a7970d9
1 changed files with 12 additions and 5 deletions

View File

@ -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() {