mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-04-12 08:34:35 +00:00
Comments: Ensure all elements in the array returned by get_comment_count() are integers.
Previously elements would be a mixture of strings and integers depending on their numeric value. Props progremzion, m.usama.masood Fixes #48093 git-svn-id: https://develop.svn.wordpress.org/trunk@47526 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -5,12 +5,12 @@ class Tests_Get_Comment_Count extends WP_UnitTestCase {
|
||||
public function test_get_comment_count() {
|
||||
$count = get_comment_count();
|
||||
|
||||
$this->assertEquals( 0, $count['approved'] );
|
||||
$this->assertEquals( 0, $count['awaiting_moderation'] );
|
||||
$this->assertEquals( 0, $count['spam'] );
|
||||
$this->assertEquals( 0, $count['trash'] );
|
||||
$this->assertEquals( 0, $count['post-trashed'] );
|
||||
$this->assertEquals( 0, $count['total_comments'] );
|
||||
$this->assertSame( 0, $count['approved'] );
|
||||
$this->assertSame( 0, $count['awaiting_moderation'] );
|
||||
$this->assertSame( 0, $count['spam'] );
|
||||
$this->assertSame( 0, $count['trash'] );
|
||||
$this->assertSame( 0, $count['post-trashed'] );
|
||||
$this->assertSame( 0, $count['total_comments'] );
|
||||
}
|
||||
|
||||
public function test_get_comment_count_approved() {
|
||||
@@ -22,12 +22,12 @@ class Tests_Get_Comment_Count extends WP_UnitTestCase {
|
||||
|
||||
$count = get_comment_count();
|
||||
|
||||
$this->assertEquals( 1, $count['approved'] );
|
||||
$this->assertEquals( 0, $count['awaiting_moderation'] );
|
||||
$this->assertEquals( 0, $count['spam'] );
|
||||
$this->assertEquals( 0, $count['trash'] );
|
||||
$this->assertEquals( 0, $count['post-trashed'] );
|
||||
$this->assertEquals( 1, $count['total_comments'] );
|
||||
$this->assertSame( 1, $count['approved'] );
|
||||
$this->assertSame( 0, $count['awaiting_moderation'] );
|
||||
$this->assertSame( 0, $count['spam'] );
|
||||
$this->assertSame( 0, $count['trash'] );
|
||||
$this->assertSame( 0, $count['post-trashed'] );
|
||||
$this->assertSame( 1, $count['total_comments'] );
|
||||
}
|
||||
|
||||
public function test_get_comment_count_awaiting() {
|
||||
@@ -39,12 +39,12 @@ class Tests_Get_Comment_Count extends WP_UnitTestCase {
|
||||
|
||||
$count = get_comment_count();
|
||||
|
||||
$this->assertEquals( 0, $count['approved'] );
|
||||
$this->assertEquals( 1, $count['awaiting_moderation'] );
|
||||
$this->assertEquals( 0, $count['spam'] );
|
||||
$this->assertEquals( 0, $count['trash'] );
|
||||
$this->assertEquals( 0, $count['post-trashed'] );
|
||||
$this->assertEquals( 1, $count['total_comments'] );
|
||||
$this->assertSame( 0, $count['approved'] );
|
||||
$this->assertSame( 1, $count['awaiting_moderation'] );
|
||||
$this->assertSame( 0, $count['spam'] );
|
||||
$this->assertSame( 0, $count['trash'] );
|
||||
$this->assertSame( 0, $count['post-trashed'] );
|
||||
$this->assertSame( 1, $count['total_comments'] );
|
||||
}
|
||||
|
||||
public function test_get_comment_count_spam() {
|
||||
@@ -56,12 +56,12 @@ class Tests_Get_Comment_Count extends WP_UnitTestCase {
|
||||
|
||||
$count = get_comment_count();
|
||||
|
||||
$this->assertEquals( 0, $count['approved'] );
|
||||
$this->assertEquals( 0, $count['awaiting_moderation'] );
|
||||
$this->assertEquals( 1, $count['spam'] );
|
||||
$this->assertEquals( 0, $count['trash'] );
|
||||
$this->assertEquals( 0, $count['post-trashed'] );
|
||||
$this->assertEquals( 1, $count['total_comments'] );
|
||||
$this->assertSame( 0, $count['approved'] );
|
||||
$this->assertSame( 0, $count['awaiting_moderation'] );
|
||||
$this->assertSame( 1, $count['spam'] );
|
||||
$this->assertSame( 0, $count['trash'] );
|
||||
$this->assertSame( 0, $count['post-trashed'] );
|
||||
$this->assertSame( 1, $count['total_comments'] );
|
||||
}
|
||||
|
||||
public function test_get_comment_count_trash() {
|
||||
@@ -73,12 +73,12 @@ class Tests_Get_Comment_Count extends WP_UnitTestCase {
|
||||
|
||||
$count = get_comment_count();
|
||||
|
||||
$this->assertEquals( 0, $count['approved'] );
|
||||
$this->assertEquals( 0, $count['awaiting_moderation'] );
|
||||
$this->assertEquals( 0, $count['spam'] );
|
||||
$this->assertEquals( 1, $count['trash'] );
|
||||
$this->assertEquals( 0, $count['post-trashed'] );
|
||||
$this->assertEquals( 0, $count['total_comments'] );
|
||||
$this->assertSame( 0, $count['approved'] );
|
||||
$this->assertSame( 0, $count['awaiting_moderation'] );
|
||||
$this->assertSame( 0, $count['spam'] );
|
||||
$this->assertSame( 1, $count['trash'] );
|
||||
$this->assertSame( 0, $count['post-trashed'] );
|
||||
$this->assertSame( 0, $count['total_comments'] );
|
||||
}
|
||||
|
||||
public function test_get_comment_count_post_trashed() {
|
||||
@@ -90,11 +90,11 @@ class Tests_Get_Comment_Count extends WP_UnitTestCase {
|
||||
|
||||
$count = get_comment_count();
|
||||
|
||||
$this->assertEquals( 0, $count['approved'] );
|
||||
$this->assertEquals( 0, $count['awaiting_moderation'] );
|
||||
$this->assertEquals( 0, $count['spam'] );
|
||||
$this->assertEquals( 0, $count['trash'] );
|
||||
$this->assertEquals( 1, $count['post-trashed'] );
|
||||
$this->assertEquals( 0, $count['total_comments'] );
|
||||
$this->assertSame( 0, $count['approved'] );
|
||||
$this->assertSame( 0, $count['awaiting_moderation'] );
|
||||
$this->assertSame( 0, $count['spam'] );
|
||||
$this->assertSame( 0, $count['trash'] );
|
||||
$this->assertSame( 1, $count['post-trashed'] );
|
||||
$this->assertSame( 0, $count['total_comments'] );
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user