From 5b344d17daaca24876bd1f6f34ee060d8c1d2570 Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Thu, 27 Oct 2022 15:53:08 +0000 Subject: [PATCH] Tests: Rename classes in `phpunit/tests/comment/` per the naming conventions. https://make.wordpress.org/core/handbook/testing/automated-testing/writing-phpunit-tests/#naming-and-organization Follow-up to [47780], [48911], [49327], [50291], [50292], [50342], [50452], [50453], [50456], [50967], [50968], [50969], [51491], [51492], [51493], [51623], [51639], [51646], [51650], [51651], [51860], [52264], [52265], [53489], [53863]. See #56793. git-svn-id: https://develop.svn.wordpress.org/trunk@54704 602fd350-edb4-49c9-b593-d223f7449a82 --- .../tests/comment/getCommentAuthorUrl.php | 2 +- .../phpunit/tests/comment/getCommentCount.php | 4 +--- .../tests/comment/getCommentExcerpt.php | 4 +--- ...odified.php => getLastCommentModified.php} | 2 +- tests/phpunit/tests/comment/metaCache.php | 2 +- tests/phpunit/tests/comment/query.php | 21 +++++++++---------- .../comment/wpBatchUpdateCommentType.php | 2 +- ...k.php => wpCheckCommentDisallowedList.php} | 4 +++- tests/phpunit/tests/comment/wpComment.php | 2 +- .../phpunit/tests/comment/wpCountComments.php | 4 +--- .../tests/comment/wpUpdateCommentCountNow.php | 9 ++++---- 11 files changed, 26 insertions(+), 30 deletions(-) rename tests/phpunit/tests/comment/{lastCommentModified.php => getLastCommentModified.php} (98%) rename tests/phpunit/tests/comment/{wpBlacklistCheck.php => wpCheckCommentDisallowedList.php} (96%) diff --git a/tests/phpunit/tests/comment/getCommentAuthorUrl.php b/tests/phpunit/tests/comment/getCommentAuthorUrl.php index c796b4f072..bc008b19fc 100644 --- a/tests/phpunit/tests/comment/getCommentAuthorUrl.php +++ b/tests/phpunit/tests/comment/getCommentAuthorUrl.php @@ -3,7 +3,7 @@ /** * @group comment * - *@covers ::get_comment_author_url + * @covers ::get_comment_author_url */ class Tests_Comment_GetCommentAuthorUrl extends WP_UnitTestCase { public function get_comment_author_url_filter( $url, $id, $comment ) { diff --git a/tests/phpunit/tests/comment/getCommentCount.php b/tests/phpunit/tests/comment/getCommentCount.php index 1f26459dfa..6b47b940a7 100644 --- a/tests/phpunit/tests/comment/getCommentCount.php +++ b/tests/phpunit/tests/comment/getCommentCount.php @@ -3,11 +3,9 @@ /** * @group comment * - * Class Tests_Get_Comment_Count - * * @covers ::get_comment_count */ -class Tests_Get_Comment_Count extends WP_UnitTestCase { +class Tests_Comment_GetCommentCount extends WP_UnitTestCase { public function test_get_comment_count() { $count = get_comment_count(); diff --git a/tests/phpunit/tests/comment/getCommentExcerpt.php b/tests/phpunit/tests/comment/getCommentExcerpt.php index 009fa747cb..0a6455054a 100644 --- a/tests/phpunit/tests/comment/getCommentExcerpt.php +++ b/tests/phpunit/tests/comment/getCommentExcerpt.php @@ -3,11 +3,9 @@ /** * @group comment * - * Class Tests_Get_Comment_Excerpt - * * @covers ::get_comment_excerpt */ -class Tests_Get_Comment_Excerpt extends WP_UnitTestCase { +class Tests_Comment_GetCommentExcerpt extends WP_UnitTestCase { protected static $bacon_comment = 'Bacon ipsum dolor amet porchetta capicola sirloin prosciutto brisket shankle jerky. Ham hock filet mignon boudin ground round, prosciutto alcatra spare ribs meatball turducken pork beef ribs ham beef. Bacon pastrami short loin, venison tri-tip ham short ribs doner swine. Tenderloin pig tongue pork jowl doner. Pork loin rump t-bone, beef strip steak flank drumstick tri-tip short loin capicola jowl. Cow filet mignon hamburger doner rump. Short loin jowl drumstick, tongue tail beef ribs pancetta flank brisket landjaeger chuck venison frankfurter turkey. Brisket shank rump, tongue beef ribs swine fatback turducken capicola meatball picanha chicken cupim meatloaf turkey. Bacon biltong shoulder tail frankfurter boudin cupim turkey drumstick. Porchetta pig shoulder, jerky flank pork tail meatball hamburger. Doner ham hock ribeye tail jerky swine. Leberkas ribeye pancetta, tenderloin capicola doner turducken chicken venison ground round boudin pork chop. Tail pork loin pig spare ribs, biltong ribeye brisket pork chop cupim. Short loin leberkas spare ribs jowl landjaeger tongue kevin flank bacon prosciutto. diff --git a/tests/phpunit/tests/comment/lastCommentModified.php b/tests/phpunit/tests/comment/getLastCommentModified.php similarity index 98% rename from tests/phpunit/tests/comment/lastCommentModified.php rename to tests/phpunit/tests/comment/getLastCommentModified.php index 3de37b0980..03229ba350 100644 --- a/tests/phpunit/tests/comment/lastCommentModified.php +++ b/tests/phpunit/tests/comment/getLastCommentModified.php @@ -6,7 +6,7 @@ * * @covers ::get_lastcommentmodified */ -class Tests_Comment_Last_Modified extends WP_UnitTestCase { +class Tests_Comment_GetLastCommentModified extends WP_UnitTestCase { public function test_no_comments() { $this->assertFalse( get_lastcommentmodified() ); } diff --git a/tests/phpunit/tests/comment/metaCache.php b/tests/phpunit/tests/comment/metaCache.php index cfbf2b32fc..bd96e8b3e1 100644 --- a/tests/phpunit/tests/comment/metaCache.php +++ b/tests/phpunit/tests/comment/metaCache.php @@ -2,7 +2,7 @@ /** * @group comment */ -class Tests_Comment_Meta_Cache extends WP_UnitTestCase { +class Tests_Comment_MetaCache extends WP_UnitTestCase { protected $i = 0; protected $queries = 0; diff --git a/tests/phpunit/tests/comment/query.php b/tests/phpunit/tests/comment/query.php index 15c23bd1a6..5a7ab9441d 100644 --- a/tests/phpunit/tests/comment/query.php +++ b/tests/phpunit/tests/comment/query.php @@ -2080,11 +2080,11 @@ class Tests_Comment_Query extends WP_UnitTestCase { $this->assertSameSets( array( $c3 ), $comment_ids ); } - /** - * @ticket 29885 - * - * @covers ::get_comments - */ + /** + * @ticket 29885 + * + * @covers ::get_comments + */ public function test_fields_author__in() { $p1 = self::factory()->post->create(); $p2 = self::factory()->post->create(); @@ -2130,11 +2130,11 @@ class Tests_Comment_Query extends WP_UnitTestCase { $this->assertSameSets( array( $c1, $c3 ), $comment_ids ); } - /** - * @ticket 29885 - * - * @covers ::get_comments - */ + /** + * @ticket 29885 + * + * @covers ::get_comments + */ public function test_fields_author__not_in() { $p1 = self::factory()->post->create(); $p2 = self::factory()->post->create(); @@ -3328,7 +3328,6 @@ class Tests_Comment_Query extends WP_UnitTestCase { } /** - * * @covers WP_Comment_Query::query */ public function test_post_name_single_value() { diff --git a/tests/phpunit/tests/comment/wpBatchUpdateCommentType.php b/tests/phpunit/tests/comment/wpBatchUpdateCommentType.php index 85a89e4cfc..d3aa7a4fda 100644 --- a/tests/phpunit/tests/comment/wpBatchUpdateCommentType.php +++ b/tests/phpunit/tests/comment/wpBatchUpdateCommentType.php @@ -5,7 +5,7 @@ * * @covers ::_wp_batch_update_comment_type */ -class Tests_Batch_Update_Comment_Type extends WP_UnitTestCase { +class Tests_Comment_wpBatchUpdateCommentType extends WP_UnitTestCase { /** * @ticket 49236 diff --git a/tests/phpunit/tests/comment/wpBlacklistCheck.php b/tests/phpunit/tests/comment/wpCheckCommentDisallowedList.php similarity index 96% rename from tests/phpunit/tests/comment/wpBlacklistCheck.php rename to tests/phpunit/tests/comment/wpCheckCommentDisallowedList.php index 86a449825d..e478c5dae6 100644 --- a/tests/phpunit/tests/comment/wpBlacklistCheck.php +++ b/tests/phpunit/tests/comment/wpCheckCommentDisallowedList.php @@ -2,8 +2,10 @@ /** * @group comment + * + * @covers ::wp_check_comment_disallowed_list */ -class Tests_WP_Blocklist_Check extends WP_UnitTestCase { +class Tests_Comment_wpCheckCommentDisallowedList extends WP_UnitTestCase { public function test_should_return_true_when_content_matches_disallowed_keys() { $author = 'Sting'; diff --git a/tests/phpunit/tests/comment/wpComment.php b/tests/phpunit/tests/comment/wpComment.php index d5a7119deb..7aa0de87a8 100644 --- a/tests/phpunit/tests/comment/wpComment.php +++ b/tests/phpunit/tests/comment/wpComment.php @@ -5,7 +5,7 @@ * * @covers WP_Comment::get_instance */ -class Tests_Term_WpComment extends WP_UnitTestCase { +class Tests_Comment_WpComment extends WP_UnitTestCase { protected static $comment_id; public static function wpSetUpBeforeClass( WP_UnitTest_Factory $factory ) { diff --git a/tests/phpunit/tests/comment/wpCountComments.php b/tests/phpunit/tests/comment/wpCountComments.php index ef3e337261..da490977f2 100644 --- a/tests/phpunit/tests/comment/wpCountComments.php +++ b/tests/phpunit/tests/comment/wpCountComments.php @@ -3,11 +3,9 @@ /** * @group comment * - * Class Tests_WP_Count_Comments - * * @covers ::wp_count_comments */ -class Tests_WP_Count_Comments extends WP_UnitTestCase { +class Tests_Comment_wpCountComments extends WP_UnitTestCase { public function test_wp_count_comments() { $count = wp_count_comments(); diff --git a/tests/phpunit/tests/comment/wpUpdateCommentCountNow.php b/tests/phpunit/tests/comment/wpUpdateCommentCountNow.php index 58b6b0d03b..42af1b0b5c 100644 --- a/tests/phpunit/tests/comment/wpUpdateCommentCountNow.php +++ b/tests/phpunit/tests/comment/wpUpdateCommentCountNow.php @@ -5,10 +5,7 @@ * * @covers ::wp_update_comment_count_now */ -class Tests_Update_Comment_Count_Now extends WP_UnitTestCase { - public function _return_100() { - return 100; - } +class Tests_Comment_wpUpdateCommentCountNow extends WP_UnitTestCase { public function test_invalid_post_bails_early() { $this->assertFalse( wp_update_comment_count_now( 100 ) ); @@ -50,4 +47,8 @@ class Tests_Update_Comment_Count_Now extends WP_UnitTestCase { remove_filter( 'pre_wp_update_comment_count_now', array( $this, '_return_100' ) ); } + + public function _return_100() { + return 100; + } }