diff --git a/tests/phpunit/tests/comment/query.php b/tests/phpunit/tests/comment/query.php index d01282dfd9162..6366dd918847f 100644 --- a/tests/phpunit/tests/comment/query.php +++ b/tests/phpunit/tests/comment/query.php @@ -140,6 +140,13 @@ public function test_query_type_empty_string() { 'comment_type' => 'luigi', ) ); + $c6 = self::factory()->comment->create( + array( + 'comment_post_ID' => self::$post_id, + 'comment_approved' => '1', + 'comment_type' => 'block_comment', + ) + ); $q = new WP_Comment_Query(); $found = $q->query( @@ -149,7 +156,8 @@ public function test_query_type_empty_string() { ) ); - $this->assertSameSets( array( $c1, $c2, $c3, $c4, $c5 ), $found ); + $this->assertSameSets( array( $c1, $c2, $c3, $c4, $c5 ), $found, 'Empty string should return all public comments.' ); + $this->assertNotContains( $c6, $found, 'Empty string should not return block comments.' ); } /** @@ -192,6 +200,13 @@ public function test_query_type_comment() { 'comment_type' => 'luigi', ) ); + $c6 = self::factory()->comment->create( + array( + 'comment_post_ID' => self::$post_id, + 'comment_approved' => '1', + 'comment_type' => 'block_comment', + ) + ); $q = new WP_Comment_Query(); $found = $q->query( @@ -201,7 +216,7 @@ public function test_query_type_comment() { ) ); - $this->assertSameSets( array( $c1 ), $found ); + $this->assertSameSets( array( $c1 ), $found, 'Comment type should return only regular comments.' ); } /** @@ -235,6 +250,13 @@ public function test_query_type_pingback() { 'comment_type' => 'trackback', ) ); + $c5 = self::factory()->comment->create( + array( + 'comment_post_ID' => self::$post_id, + 'comment_approved' => '1', + 'comment_type' => 'block_comment', + ) + ); $q = new WP_Comment_Query(); $found = $q->query( @@ -244,7 +266,7 @@ public function test_query_type_pingback() { ) ); - $this->assertSameSets( array( $c2, $c3 ), $found ); + $this->assertSameSets( array( $c2, $c3 ), $found, 'Pingback type should return only pingbacks.' ); } /** @@ -278,6 +300,13 @@ public function test_query_type_trackback() { 'comment_type' => 'pingback', ) ); + $c5 = self::factory()->comment->create( + array( + 'comment_post_ID' => self::$post_id, + 'comment_approved' => '1', + 'comment_type' => 'block_comment', + ) + ); $q = new WP_Comment_Query(); $found = $q->query( @@ -287,7 +316,7 @@ public function test_query_type_trackback() { ) ); - $this->assertSameSets( array( $c2, $c3 ), $found ); + $this->assertSameSets( array( $c2, $c3 ), $found, 'Trackback type should return only trackbacks.' ); } /** @@ -330,6 +359,13 @@ public function test_query_type_pings() { 'comment_type' => 'luigi', ) ); + $c6 = self::factory()->comment->create( + array( + 'comment_post_ID' => self::$post_id, + 'comment_approved' => '1', + 'comment_type' => 'block_comment', + ) + ); $q = new WP_Comment_Query(); $found = $q->query( @@ -339,7 +375,7 @@ public function test_query_type_pings() { ) ); - $this->assertSameSets( array( $c2, $c3 ), $found ); + $this->assertSameSets( array( $c2, $c3 ), $found, 'Pings type should return only trackbacks and pingbacks.' ); } /** @@ -391,6 +427,13 @@ public function test_type_array_comments_and_custom() { 'comment_type' => 'mario', ) ); + $c7 = self::factory()->comment->create( + array( + 'comment_post_ID' => self::$post_id, + 'comment_approved' => '1', + 'comment_type' => 'block_comment', + ) + ); $q = new WP_Comment_Query(); $found = $q->query( @@ -400,7 +443,7 @@ public function test_type_array_comments_and_custom() { ) ); - $this->assertSameSets( array( $c1, $c4, $c6 ), $found ); + $this->assertSameSets( array( $c1, $c4, $c6 ), $found, 'Comments + custom type should return regular comments and custom type.' ); } /** @@ -450,6 +493,13 @@ public function test_type_not__in_array_custom() { 'comment_type' => 'mario', ) ); + $c7 = self::factory()->comment->create( + array( + 'comment_post_ID' => self::$post_id, + 'comment_approved' => '1', + 'comment_type' => 'block_comment', + ) + ); $q = new WP_Comment_Query(); $found = $q->query( @@ -459,7 +509,8 @@ public function test_type_not__in_array_custom() { ) ); - $this->assertSameSets( array( $c1, $c2, $c3, $c4, $c6 ), $found ); + $this->assertSameSets( array( $c1, $c2, $c3, $c4, $c6 ), $found, 'Not in luigi should return all but luigi.' ); + $this->assertNotContains( $c7, $found, 'Not in luigi should not return block comments.' ); } /**