| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 4b42334 commit fe18be2
3 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -368,13 +368,13 @@ function get_lastcommentmodified( $timezone = 'server' ) { | |||
| 368 | 368 | * @return array() { | |
| 369 | 369 | * The number of comments keyed by their status. | |
| 370 | 370 | * | |
| 371 | - * @type int|string $approved The number of approved comments. | ||
| 372 | - * @type int|string $awaiting_moderation The number of comments awaiting moderation (a.k.a. pending). | ||
| 373 | - * @type int|string $spam The number of spam comments. | ||
| 374 | - * @type int|string $trash The number of trashed comments. | ||
| 375 | - * @type int|string $post-trashed The number of comments for posts that are in the trash. | ||
| 376 | - * @type int $total_comments The total number of non-trashed comments, including spam. | ||
| 377 | - * @type int $all The total number of pending or approved comments. | ||
| 371 | + * @type int $approved The number of approved comments. | ||
| 372 | + * @type int $awaiting_moderation The number of comments awaiting moderation (a.k.a. pending). | ||
| 373 | + * @type int $spam The number of spam comments. | ||
| 374 | + * @type int $trash The number of trashed comments. | ||
| 375 | + * @type int $post-trashed The number of comments for posts that are in the trash. | ||
| 376 | + * @type int $total_comments The total number of non-trashed comments, including spam. | ||
| 377 | + * @type int $all The total number of pending or approved comments. | ||
| 378 | 378 | * } | |
| 379 | 379 | */ | |
| 380 | 380 | function get_comment_count( $post_id = 0 ) { | |
@@ -434,7 +434,7 @@ function get_comment_count( $post_id = 0 ) { | |||
| 434 | 434 | } | |
| 435 | 435 | } | |
| 436 | 436 | ||
| 437 | - return $comment_count; | ||
| 437 | + return array_map( 'intval', $comment_count ); | ||
| 438 | 438 | } | |
| 439 | 439 | ||
| 440 | 440 | // | |
@@ -1321,13 +1321,13 @@ function wp_blacklist_check( $author, $email, $url, $comment, $user_ip, $user_ag | |||
| 1321 | 1321 | * @return stdClass { | |
| 1322 | 1322 | * The number of comments keyed by their status. | |
| 1323 | 1323 | * | |
| 1324 | - * @type int|string $approved The number of approved comments. | ||
| 1325 | - * @type int|string $moderated The number of comments awaiting moderation (a.k.a. pending). | ||
| 1326 | - * @type int|string $spam The number of spam comments. | ||
| 1327 | - * @type int|string $trash The number of trashed comments. | ||
| 1328 | - * @type int|string $post-trashed The number of comments for posts that are in the trash. | ||
| 1329 | - * @type int $total_comments The total number of non-trashed comments, including spam. | ||
| 1330 | - * @type int $all The total number of pending or approved comments. | ||
| 1324 | + * @type int $approved The number of approved comments. | ||
| 1325 | + * @type int $moderated The number of comments awaiting moderation (a.k.a. pending). | ||
| 1326 | + * @type int $spam The number of spam comments. | ||
| 1327 | + * @type int $trash The number of trashed comments. | ||
| 1328 | + * @type int $post-trashed The number of comments for posts that are in the trash. | ||
| 1329 | + * @type int $total_comments The total number of non-trashed comments, including spam. | ||
| 1330 | + * @type int $all The total number of pending or approved comments. | ||
| 1331 | 1331 | * } | |
| 1332 | 1332 | */ | |
| 1333 | 1333 | function wp_count_comments( $post_id = 0 ) { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -5,12 +5,12 @@ class Tests_Get_Comment_Count extends WP_UnitTestCase { | |||
| 5 | 5 | public function test_get_comment_count() { | |
| 6 | 6 | $count = get_comment_count(); | |
| 7 | 7 | ||
| 8 | - $this->assertEquals( 0, $count['approved'] ); | ||
| 9 | - $this->assertEquals( 0, $count['awaiting_moderation'] ); | ||
| 10 | - $this->assertEquals( 0, $count['spam'] ); | ||
| 11 | - $this->assertEquals( 0, $count['trash'] ); | ||
| 12 | - $this->assertEquals( 0, $count['post-trashed'] ); | ||
| 13 | - $this->assertEquals( 0, $count['total_comments'] ); | ||
| 8 | + $this->assertSame( 0, $count['approved'] ); | ||
| 9 | + $this->assertSame( 0, $count['awaiting_moderation'] ); | ||
| 10 | + $this->assertSame( 0, $count['spam'] ); | ||
| 11 | + $this->assertSame( 0, $count['trash'] ); | ||
| 12 | + $this->assertSame( 0, $count['post-trashed'] ); | ||
| 13 | + $this->assertSame( 0, $count['total_comments'] ); | ||
| 14 | 14 | } | |
| 15 | 15 | ||
| 16 | 16 | public function test_get_comment_count_approved() { | |
@@ -22,12 +22,12 @@ public function test_get_comment_count_approved() { | |||
| 22 | 22 | ||
| 23 | 23 | $count = get_comment_count(); | |
| 24 | 24 | ||
| 25 | - $this->assertEquals( 1, $count['approved'] ); | ||
| 26 | - $this->assertEquals( 0, $count['awaiting_moderation'] ); | ||
| 27 | - $this->assertEquals( 0, $count['spam'] ); | ||
| 28 | - $this->assertEquals( 0, $count['trash'] ); | ||
| 29 | - $this->assertEquals( 0, $count['post-trashed'] ); | ||
| 30 | - $this->assertEquals( 1, $count['total_comments'] ); | ||
| 25 | + $this->assertSame( 1, $count['approved'] ); | ||
| 26 | + $this->assertSame( 0, $count['awaiting_moderation'] ); | ||
| 27 | + $this->assertSame( 0, $count['spam'] ); | ||
| 28 | + $this->assertSame( 0, $count['trash'] ); | ||
| 29 | + $this->assertSame( 0, $count['post-trashed'] ); | ||
| 30 | + $this->assertSame( 1, $count['total_comments'] ); | ||
| 31 | 31 | } | |
| 32 | 32 | ||
| 33 | 33 | public function test_get_comment_count_awaiting() { | |
@@ -39,12 +39,12 @@ public function test_get_comment_count_awaiting() { | |||
| 39 | 39 | ||
| 40 | 40 | $count = get_comment_count(); | |
| 41 | 41 | ||
| 42 | - $this->assertEquals( 0, $count['approved'] ); | ||
| 43 | - $this->assertEquals( 1, $count['awaiting_moderation'] ); | ||
| 44 | - $this->assertEquals( 0, $count['spam'] ); | ||
| 45 | - $this->assertEquals( 0, $count['trash'] ); | ||
| 46 | - $this->assertEquals( 0, $count['post-trashed'] ); | ||
| 47 | - $this->assertEquals( 1, $count['total_comments'] ); | ||
| 42 | + $this->assertSame( 0, $count['approved'] ); | ||
| 43 | + $this->assertSame( 1, $count['awaiting_moderation'] ); | ||
| 44 | + $this->assertSame( 0, $count['spam'] ); | ||
| 45 | + $this->assertSame( 0, $count['trash'] ); | ||
| 46 | + $this->assertSame( 0, $count['post-trashed'] ); | ||
| 47 | + $this->assertSame( 1, $count['total_comments'] ); | ||
| 48 | 48 | } | |
| 49 | 49 | ||
| 50 | 50 | public function test_get_comment_count_spam() { | |
@@ -56,12 +56,12 @@ public function test_get_comment_count_spam() { | |||
| 56 | 56 | ||
| 57 | 57 | $count = get_comment_count(); | |
| 58 | 58 | ||
| 59 | - $this->assertEquals( 0, $count['approved'] ); | ||
| 60 | - $this->assertEquals( 0, $count['awaiting_moderation'] ); | ||
| 61 | - $this->assertEquals( 1, $count['spam'] ); | ||
| 62 | - $this->assertEquals( 0, $count['trash'] ); | ||
| 63 | - $this->assertEquals( 0, $count['post-trashed'] ); | ||
| 64 | - $this->assertEquals( 1, $count['total_comments'] ); | ||
| 59 | + $this->assertSame( 0, $count['approved'] ); | ||
| 60 | + $this->assertSame( 0, $count['awaiting_moderation'] ); | ||
| 61 | + $this->assertSame( 1, $count['spam'] ); | ||
| 62 | + $this->assertSame( 0, $count['trash'] ); | ||
| 63 | + $this->assertSame( 0, $count['post-trashed'] ); | ||
| 64 | + $this->assertSame( 1, $count['total_comments'] ); | ||
| 65 | 65 | } | |
| 66 | 66 | ||
| 67 | 67 | public function test_get_comment_count_trash() { | |
@@ -73,12 +73,12 @@ public function test_get_comment_count_trash() { | |||
| 73 | 73 | ||
| 74 | 74 | $count = get_comment_count(); | |
| 75 | 75 | ||
| 76 | - $this->assertEquals( 0, $count['approved'] ); | ||
| 77 | - $this->assertEquals( 0, $count['awaiting_moderation'] ); | ||
| 78 | - $this->assertEquals( 0, $count['spam'] ); | ||
| 79 | - $this->assertEquals( 1, $count['trash'] ); | ||
| 80 | - $this->assertEquals( 0, $count['post-trashed'] ); | ||
| 81 | - $this->assertEquals( 0, $count['total_comments'] ); | ||
| 76 | + $this->assertSame( 0, $count['approved'] ); | ||
| 77 | + $this->assertSame( 0, $count['awaiting_moderation'] ); | ||
| 78 | + $this->assertSame( 0, $count['spam'] ); | ||
| 79 | + $this->assertSame( 1, $count['trash'] ); | ||
| 80 | + $this->assertSame( 0, $count['post-trashed'] ); | ||
| 81 | + $this->assertSame( 0, $count['total_comments'] ); | ||
| 82 | 82 | } | |
| 83 | 83 | ||
| 84 | 84 | public function test_get_comment_count_post_trashed() { | |
@@ -90,11 +90,11 @@ public function test_get_comment_count_post_trashed() { | |||
| 90 | 90 | ||
| 91 | 91 | $count = get_comment_count(); | |
| 92 | 92 | ||
| 93 | - $this->assertEquals( 0, $count['approved'] ); | ||
| 94 | - $this->assertEquals( 0, $count['awaiting_moderation'] ); | ||
| 95 | - $this->assertEquals( 0, $count['spam'] ); | ||
| 96 | - $this->assertEquals( 0, $count['trash'] ); | ||
| 97 | - $this->assertEquals( 1, $count['post-trashed'] ); | ||
| 98 | - $this->assertEquals( 0, $count['total_comments'] ); | ||
| 93 | + $this->assertSame( 0, $count['approved'] ); | ||
| 94 | + $this->assertSame( 0, $count['awaiting_moderation'] ); | ||
| 95 | + $this->assertSame( 0, $count['spam'] ); | ||
| 96 | + $this->assertSame( 0, $count['trash'] ); | ||
| 97 | + $this->assertSame( 1, $count['post-trashed'] ); | ||
| 98 | + $this->assertSame( 0, $count['total_comments'] ); | ||
| 99 | 99 | } | |
| 100 | 100 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -81,7 +81,7 @@ function test_small_import() { | |||
| 81 | 81 | $this->assertEquals( 4, $page_count->publish ); | |
| 82 | 82 | $this->assertEquals( 1, $page_count->draft ); | |
| 83 | 83 | $comment_count = wp_count_comments(); | |
| 84 | - $this->assertEquals( 1, $comment_count->total_comments ); | ||
| 84 | + $this->assertSame( 1, $comment_count->total_comments ); | ||
| 85 | 85 | ||
| 86 | 86 | $posts = get_posts( | |
| 87 | 87 | array( | |
@@ -245,7 +245,7 @@ function test_double_import() { | |||
| 245 | 245 | $this->assertEquals( 4, $page_count->publish ); | |
| 246 | 246 | $this->assertEquals( 1, $page_count->draft ); | |
| 247 | 247 | $comment_count = wp_count_comments(); | |
| 248 | - $this->assertEquals( 1, $comment_count->total_comments ); | ||
| 248 | + $this->assertSame( 1, $comment_count->total_comments ); | ||
| 249 | 249 | } | |
| 250 | 250 | ||
| 251 | 251 | function test_ordering_of_importers() { | |
| Back | FazBrowse Home | New Git URL |
0 commit comments