From 5fc726c2229b78dcfee40c534c8eac5e979aa911 Mon Sep 17 00:00:00 2001 From: Scott Taylor Date: Thu, 15 Oct 2015 05:56:47 +0000 Subject: [PATCH] Unit Tests: in `Tests_Comment_Query::test_get_comments_for_post()`, create fewer comments (5, instead of 10). See #30017, #33968. git-svn-id: https://develop.svn.wordpress.org/trunk@35192 602fd350-edb4-49c9-b593-d223f7449a82 --- tests/phpunit/tests/comment/query.php | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/tests/phpunit/tests/comment/query.php b/tests/phpunit/tests/comment/query.php index 3a5e351b14..783974e7b7 100644 --- a/tests/phpunit/tests/comment/query.php +++ b/tests/phpunit/tests/comment/query.php @@ -535,32 +535,34 @@ class Tests_Comment_Query extends WP_UnitTestCase { } function test_get_comments_for_post() { + $limit = 5; + $post_id = $this->factory->post->create(); - $this->factory->comment->create_post_comments( $post_id, 10 ); + $this->factory->comment->create_post_comments( $post_id, $limit ); $comments = get_comments( array( 'post_id' => $post_id ) ); - $this->assertEquals( 10, count( $comments ) ); + $this->assertEquals( $limit, count( $comments ) ); foreach ( $comments as $comment ) { $this->assertEquals( $post_id, $comment->comment_post_ID ); } $post_id2 = $this->factory->post->create(); - $this->factory->comment->create_post_comments( $post_id2, 10 ); + $this->factory->comment->create_post_comments( $post_id2, $limit ); $comments = get_comments( array( 'post_id' => $post_id2 ) ); - $this->assertEquals( 10, count( $comments ) ); + $this->assertEquals( $limit, count( $comments ) ); foreach ( $comments as $comment ) { $this->assertEquals( $post_id2, $comment->comment_post_ID ); } $post_id3 = $this->factory->post->create(); - $this->factory->comment->create_post_comments( $post_id3, 10, array( 'comment_approved' => '0' ) ); + $this->factory->comment->create_post_comments( $post_id3, $limit, array( 'comment_approved' => '0' ) ); $comments = get_comments( array( 'post_id' => $post_id3 ) ); - $this->assertEquals( 10, count( $comments ) ); + $this->assertEquals( $limit, count( $comments ) ); foreach ( $comments as $comment ) { $this->assertEquals( $post_id3, $comment->comment_post_ID ); } $comments = get_comments( array( 'post_id' => $post_id3, 'status' => 'hold' ) ); - $this->assertEquals( 10, count( $comments ) ); + $this->assertEquals( $limit, count( $comments ) ); foreach ( $comments as $comment ) { $this->assertEquals( $post_id3, $comment->comment_post_ID ); } @@ -568,9 +570,9 @@ class Tests_Comment_Query extends WP_UnitTestCase { $comments = get_comments( array( 'post_id' => $post_id3, 'status' => 'approve' ) ); $this->assertEquals( 0, count( $comments ) ); - $this->factory->comment->create_post_comments( $post_id3, 10, array( 'comment_approved' => '1' ) ); + $this->factory->comment->create_post_comments( $post_id3, $limit, array( 'comment_approved' => '1' ) ); $comments = get_comments( array( 'post_id' => $post_id3 ) ); - $this->assertEquals( 20, count( $comments ) ); + $this->assertEquals( $limit * 2, count( $comments ) ); foreach ( $comments as $comment ) { $this->assertEquals( $post_id3, $comment->comment_post_ID ); }