wordpress-develop/tests/phpunit/tests/comment
Peter Wilson 2a753c1057 Comments: Prevent replying to unapproved comments.
Introduces client and server side validation to ensure the `replytocom` query string parameter can not be exploited to reply to an unapproved comment or display the name of an unapproved commenter.

This only affects commenting via the front end of the site. Comment replies via the dashboard continue their current behaviour of logging the reply and approving the parent comment.

Introduces the `$post` parameter, defaulting to the current global post, to `get_cancel_comment_reply_link()` and `comment_form_title()`.

Introduces `_get_comment_reply_id()` for determining the comment reply ID based on the `replytocom` query string parameter.

Renames the parameter `$post_id` to `$post` in `get_comment_id_fields()` and `comment_id_fields()` to accept either a post ID or `WP_Post` object.

Adds a new `WP_Error` return state to `wp_handle_comment_submission()` to prevent replies to unapproved comments. The error code is `comment_reply_to_unapproved_comment` with the message `Sorry, replies to unapproved comments are not allowed.`.

Props costdev, jrf, hellofromtonya, fasuto, boniu91, milana_cap.
Fixes #53962.


git-svn-id: https://develop.svn.wordpress.org/trunk@55369 602fd350-edb4-49c9-b593-d223f7449a82
2023-02-21 01:43:33 +00:00
..
checkComment.php Comments: Make moderated or disallowed key check case-insensitive for non-Latin words. 2022-11-28 19:42:56 +00:00
commentForm.php Comments: Return early from comment_form() if an invalid post ID is passed. 2022-10-11 15:43:04 +00:00
commentsOpen.php Tests: Use the factory method instead of the property. 2022-09-06 22:09:49 +00:00
commentsTemplate.php Build/Test Tools: Add @covers tags to the comments tests. 2022-08-08 23:12:30 +00:00
dateQuery.php Build/Test Tools: Add @covers tags to the comments tests. 2022-08-08 23:12:30 +00:00
getCommentAuthorEmailLink.php Build/Test Tools: Add @covers tags to the comments tests. 2022-08-08 23:12:30 +00:00
getCommentAuthorUrl.php Tests: Rename classes in phpunit/tests/comment/ per the naming conventions. 2022-10-27 15:53:08 +00:00
getCommentAuthorUrlLink.php Build/Test Tools: Add @covers tags to the comments tests. 2022-08-08 23:12:30 +00:00
getCommentClass.php Build/Test Tools: Add @covers tags to the comments tests. 2022-08-08 23:12:30 +00:00
getCommentCount.php Tests: Rename classes in phpunit/tests/comment/ per the naming conventions. 2022-10-27 15:53:08 +00:00
getCommentExcerpt.php Tests: Rename classes in phpunit/tests/comment/ per the naming conventions. 2022-10-27 15:53:08 +00:00
getCommentLink.php Build/Test Tools: Add @covers tags to the comments tests. 2022-08-08 23:12:30 +00:00
getCommentReplyLink.php Build/Test Tools: Add @covers tags to the comments tests. 2022-08-08 23:12:30 +00:00
getCommentsPagesCount.php Tests: Replace some occurrences of assertEquals() with assertSame(). 2022-10-07 01:02:07 +00:00
getLastCommentModified.php Tests: Rename classes in phpunit/tests/comment/ per the naming conventions. 2022-10-27 15:53:08 +00:00
getPageOfComment.php Build/Test Tools: Add @covers tags to the comments tests. 2022-08-08 23:12:30 +00:00
isAvatarCommentType.php Tests: Merge file-level and class-level DocBlocks in various unit test files. 2023-02-14 16:10:13 +00:00
metaCache.php Tests: Rename classes in phpunit/tests/comment/ per the naming conventions. 2022-10-27 15:53:08 +00:00
pingsOpen.php Tests: Use the factory method instead of the property. 2022-09-06 22:09:49 +00:00
query.php Tests: Rename classes in phpunit/tests/comment/ per the naming conventions. 2022-10-27 15:53:08 +00:00
slashes.php Build/Test Tools: Add @covers tags to the comments tests. 2022-08-08 23:12:30 +00:00
template.php Tests: Use the factory method instead of the property. 2022-09-06 22:09:49 +00:00
walker.php Code Modernization: Remove dynamic properties in Tests_Comment_Walker. 2022-08-24 14:03:12 +00:00
wpAllowComment.php Build/Test Tools: Add @covers tags to the comments tests. 2022-08-08 23:12:30 +00:00
wpBatchUpdateCommentType.php Tests: Rename classes in phpunit/tests/comment/ per the naming conventions. 2022-10-27 15:53:08 +00:00
wpCheckCommentDisallowedList.php Comments: Make moderated or disallowed key check case-insensitive for non-Latin words. 2022-11-28 19:42:56 +00:00
wpComment.php Tests: Rename classes in phpunit/tests/comment/ per the naming conventions. 2022-10-27 15:53:08 +00:00
wpCommentsPersonalDataEraser.php Comments: Use correct orderby parameter name in personal data exporter and eraser. 2023-02-13 22:03:30 +00:00
wpCommentsPersonalDataExporter.php Comments: Use correct orderby parameter name in personal data exporter and eraser. 2023-02-13 22:03:30 +00:00
wpCountComments.php Tests: Rename classes in phpunit/tests/comment/ per the naming conventions. 2022-10-27 15:53:08 +00:00
wpHandleCommentSubmission.php Comments: Prevent replying to unapproved comments. 2023-02-21 01:43:33 +00:00
wpListComments.php Build/Test Tools: Add @covers tags to the comments tests. 2022-08-08 23:12:30 +00:00
wpUpdateCommentCountNow.php Tests: Rename classes in phpunit/tests/comment/ per the naming conventions. 2022-10-27 15:53:08 +00:00