Code is Poetry.

WordPress' code just... wasn't.
This is now dealt with.

Props jrf, pento, netweb, GaryJ, jdgrimes, westonruter, Greg Sherwood from PHPCS, and everyone who's ever contributed to WPCS and PHPCS.
Fixes #41057.



git-svn-id: https://develop.svn.wordpress.org/trunk@42343 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Gary Pendergast
2017-11-30 23:09:33 +00:00
parent ec6a089f98
commit 8f95800d52
1103 changed files with 105978 additions and 78184 deletions
+36 -22
View File
@@ -15,9 +15,11 @@ class Tests_WP_Count_Comments extends WP_UnitTestCase {
}
public function test_wp_count_comments_approved() {
self::factory()->comment->create( array(
'comment_approved' => 1
) );
self::factory()->comment->create(
array(
'comment_approved' => 1,
)
);
$count = wp_count_comments();
@@ -31,9 +33,11 @@ class Tests_WP_Count_Comments extends WP_UnitTestCase {
}
public function test_wp_count_comments_awaiting() {
self::factory()->comment->create( array(
'comment_approved' => 0
) );
self::factory()->comment->create(
array(
'comment_approved' => 0,
)
);
$count = wp_count_comments();
@@ -47,9 +51,11 @@ class Tests_WP_Count_Comments extends WP_UnitTestCase {
}
public function test_wp_count_comments_spam() {
self::factory()->comment->create( array(
'comment_approved' => 'spam'
) );
self::factory()->comment->create(
array(
'comment_approved' => 'spam',
)
);
$count = wp_count_comments();
@@ -63,9 +69,11 @@ class Tests_WP_Count_Comments extends WP_UnitTestCase {
}
public function test_wp_count_comments_trash() {
self::factory()->comment->create( array(
'comment_approved' => 'trash'
) );
self::factory()->comment->create(
array(
'comment_approved' => 'trash',
)
);
$count = wp_count_comments();
@@ -79,9 +87,11 @@ class Tests_WP_Count_Comments extends WP_UnitTestCase {
}
public function test_wp_count_comments_post_trashed() {
self::factory()->comment->create( array(
'comment_approved' => 'post-trashed'
) );
self::factory()->comment->create(
array(
'comment_approved' => 'post-trashed',
)
);
$count = wp_count_comments();
@@ -95,13 +105,17 @@ class Tests_WP_Count_Comments extends WP_UnitTestCase {
}
public function test_wp_count_comments_cache() {
$post_id = self::factory()->post->create( array(
'post_status' => 'publish'
) );
$comment_id = self::factory()->comment->create( array(
'comment_approved' => '1',
'comment_post_ID' => $post_id
) );
$post_id = self::factory()->post->create(
array(
'post_status' => 'publish',
)
);
$comment_id = self::factory()->comment->create(
array(
'comment_approved' => '1',
'comment_post_ID' => $post_id,
)
);
$count1 = wp_count_comments( $post_id );