mirror of
git://develop.git.wordpress.org/
synced 2025-02-07 16:10:43 +01:00
Tests: Move wp_handle_comment_submission()
tests to the comment
directory.
This aims to bring some consistency with other comment function tests. Includes moving the `@covers` tags from individual test methods to the class DocBlock. Follow-up to [34799], [34801], [53863]. See #56793. git-svn-id: https://develop.svn.wordpress.org/trunk@54701 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
b71a7bfcff
commit
de38bf25bb
@ -2,8 +2,10 @@
|
||||
|
||||
/**
|
||||
* @group comment
|
||||
*
|
||||
* @covers ::wp_handle_comment_submission
|
||||
*/
|
||||
class Tests_Comment_Submission extends WP_UnitTestCase {
|
||||
class Tests_Comment_wpHandleCommentSubmission extends WP_UnitTestCase {
|
||||
|
||||
protected static $post;
|
||||
protected static $author_id;
|
||||
@ -39,9 +41,6 @@ class Tests_Comment_Submission extends WP_UnitTestCase {
|
||||
require_once ABSPATH . WPINC . '/class-phpass.php';
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers ::wp_handle_comment_submission
|
||||
*/
|
||||
public function test_submitting_comment_to_invalid_post_returns_error() {
|
||||
$error = 'comment_id_not_found';
|
||||
|
||||
@ -58,9 +57,6 @@ class Tests_Comment_Submission extends WP_UnitTestCase {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers ::wp_handle_comment_submission
|
||||
*/
|
||||
public function test_submitting_comment_to_post_with_closed_comments_returns_error() {
|
||||
|
||||
$error = 'comment_closed';
|
||||
@ -84,9 +80,6 @@ class Tests_Comment_Submission extends WP_UnitTestCase {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers ::wp_handle_comment_submission
|
||||
*/
|
||||
public function test_submitting_comment_to_trashed_post_returns_error() {
|
||||
|
||||
$error = 'comment_on_trash';
|
||||
@ -108,9 +101,6 @@ class Tests_Comment_Submission extends WP_UnitTestCase {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers ::wp_handle_comment_submission
|
||||
*/
|
||||
public function test_submitting_comment_to_draft_post_returns_error() {
|
||||
$error = 'comment_on_draft';
|
||||
|
||||
@ -136,8 +126,6 @@ class Tests_Comment_Submission extends WP_UnitTestCase {
|
||||
|
||||
/**
|
||||
* @ticket 39650
|
||||
*
|
||||
* @covers ::wp_handle_comment_submission
|
||||
*/
|
||||
public function test_submitting_comment_to_draft_post_returns_error_message_for_user_with_correct_caps() {
|
||||
$error = 'comment_on_draft';
|
||||
@ -164,9 +152,6 @@ class Tests_Comment_Submission extends WP_UnitTestCase {
|
||||
$this->assertNotEmpty( $comment->get_error_message() );
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers ::wp_handle_comment_submission
|
||||
*/
|
||||
public function test_submitting_comment_to_scheduled_post_returns_error() {
|
||||
|
||||
// Same error as commenting on a draft.
|
||||
@ -193,9 +178,6 @@ class Tests_Comment_Submission extends WP_UnitTestCase {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers ::wp_handle_comment_submission
|
||||
*/
|
||||
public function test_submitting_comment_to_password_required_post_returns_error() {
|
||||
|
||||
$error = 'comment_on_password_protected';
|
||||
@ -219,9 +201,6 @@ class Tests_Comment_Submission extends WP_UnitTestCase {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers ::wp_handle_comment_submission
|
||||
*/
|
||||
public function test_submitting_comment_to_password_protected_post_succeeds() {
|
||||
$password = 'password';
|
||||
$hasher = new PasswordHash( 8, true );
|
||||
@ -249,9 +228,6 @@ class Tests_Comment_Submission extends WP_UnitTestCase {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers ::wp_handle_comment_submission
|
||||
*/
|
||||
public function test_submitting_valid_comment_as_logged_in_user_succeeds() {
|
||||
|
||||
$user = self::factory()->user->create_and_get(
|
||||
@ -279,9 +255,6 @@ class Tests_Comment_Submission extends WP_UnitTestCase {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers ::wp_handle_comment_submission
|
||||
*/
|
||||
public function test_submitting_valid_comment_anonymously_succeeds() {
|
||||
|
||||
$data = array(
|
||||
@ -308,8 +281,6 @@ class Tests_Comment_Submission extends WP_UnitTestCase {
|
||||
* wp_handle_comment_submission() expects un-slashed data.
|
||||
*
|
||||
* @group slashes
|
||||
*
|
||||
* @covers ::wp_handle_comment_submission
|
||||
*/
|
||||
public function test_submitting_comment_handles_slashes_correctly() {
|
||||
$data = array(
|
||||
@ -329,9 +300,6 @@ class Tests_Comment_Submission extends WP_UnitTestCase {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers ::wp_handle_comment_submission
|
||||
*/
|
||||
public function test_submitting_comment_anonymously_to_private_post_returns_error() {
|
||||
|
||||
$error = 'comment_id_not_found';
|
||||
@ -353,9 +321,6 @@ class Tests_Comment_Submission extends WP_UnitTestCase {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers ::wp_handle_comment_submission
|
||||
*/
|
||||
public function test_submitting_comment_as_logged_in_user_to_inaccessible_private_post_returns_error() {
|
||||
|
||||
$error = 'comment_id_not_found';
|
||||
@ -386,9 +351,6 @@ class Tests_Comment_Submission extends WP_UnitTestCase {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers ::wp_handle_comment_submission
|
||||
*/
|
||||
public function test_submitting_comment_to_private_post_with_closed_comments_returns_correct_error() {
|
||||
|
||||
$error = 'comment_id_not_found';
|
||||
@ -420,9 +382,6 @@ class Tests_Comment_Submission extends WP_UnitTestCase {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers ::wp_handle_comment_submission
|
||||
*/
|
||||
public function test_submitting_comment_to_own_private_post_succeeds() {
|
||||
|
||||
wp_set_current_user( self::$author_id );
|
||||
@ -446,9 +405,6 @@ class Tests_Comment_Submission extends WP_UnitTestCase {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers ::wp_handle_comment_submission
|
||||
*/
|
||||
public function test_submitting_comment_to_accessible_private_post_succeeds() {
|
||||
|
||||
wp_set_current_user( self::$editor_id );
|
||||
@ -472,9 +428,6 @@ class Tests_Comment_Submission extends WP_UnitTestCase {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers ::wp_handle_comment_submission
|
||||
*/
|
||||
public function test_anonymous_user_cannot_comment_unfiltered_html() {
|
||||
$data = array(
|
||||
'comment_post_ID' => self::$post->ID,
|
||||
@ -490,9 +443,6 @@ class Tests_Comment_Submission extends WP_UnitTestCase {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers ::wp_handle_comment_submission
|
||||
*/
|
||||
public function test_unprivileged_user_cannot_comment_unfiltered_html() {
|
||||
|
||||
wp_set_current_user( self::$author_id );
|
||||
@ -511,9 +461,6 @@ class Tests_Comment_Submission extends WP_UnitTestCase {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers ::wp_handle_comment_submission
|
||||
*/
|
||||
public function test_unprivileged_user_cannot_comment_unfiltered_html_even_with_valid_nonce() {
|
||||
|
||||
wp_set_current_user( self::$author_id );
|
||||
@ -538,9 +485,6 @@ class Tests_Comment_Submission extends WP_UnitTestCase {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers ::wp_handle_comment_submission
|
||||
*/
|
||||
public function test_privileged_user_can_comment_unfiltered_html_with_valid_nonce() {
|
||||
|
||||
$this->assertFalse( defined( 'DISALLOW_UNFILTERED_HTML' ) );
|
||||
@ -573,9 +517,6 @@ class Tests_Comment_Submission extends WP_UnitTestCase {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers ::wp_handle_comment_submission
|
||||
*/
|
||||
public function test_privileged_user_cannot_comment_unfiltered_html_without_valid_nonce() {
|
||||
|
||||
if ( is_multisite() ) {
|
||||
@ -600,9 +541,6 @@ class Tests_Comment_Submission extends WP_UnitTestCase {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers ::wp_handle_comment_submission
|
||||
*/
|
||||
public function test_submitting_comment_as_anonymous_user_when_registration_required_returns_error() {
|
||||
|
||||
$error = 'not_logged_in';
|
||||
@ -622,9 +560,6 @@ class Tests_Comment_Submission extends WP_UnitTestCase {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers ::wp_handle_comment_submission
|
||||
*/
|
||||
public function test_submitting_comment_with_no_name_when_name_email_required_returns_error() {
|
||||
|
||||
$error = 'require_name_email';
|
||||
@ -646,9 +581,6 @@ class Tests_Comment_Submission extends WP_UnitTestCase {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers ::wp_handle_comment_submission
|
||||
*/
|
||||
public function test_submitting_comment_with_no_email_when_name_email_required_returns_error() {
|
||||
|
||||
$error = 'require_name_email';
|
||||
@ -670,9 +602,6 @@ class Tests_Comment_Submission extends WP_UnitTestCase {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers ::wp_handle_comment_submission
|
||||
*/
|
||||
public function test_submitting_comment_with_invalid_email_when_name_email_required_returns_error() {
|
||||
|
||||
$error = 'require_valid_email';
|
||||
@ -695,9 +624,6 @@ class Tests_Comment_Submission extends WP_UnitTestCase {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers ::wp_handle_comment_submission
|
||||
*/
|
||||
public function test_submitting_comment_with_no_comment_content_returns_error() {
|
||||
|
||||
$error = 'require_valid_comment';
|
||||
@ -717,8 +643,6 @@ class Tests_Comment_Submission extends WP_UnitTestCase {
|
||||
|
||||
/**
|
||||
* @ticket 10377
|
||||
*
|
||||
* @covers ::wp_handle_comment_submission
|
||||
*/
|
||||
public function test_submitting_comment_with_content_too_long_returns_error() {
|
||||
$error = 'comment_content_column_length';
|
||||
@ -737,8 +661,6 @@ class Tests_Comment_Submission extends WP_UnitTestCase {
|
||||
|
||||
/**
|
||||
* @ticket 10377
|
||||
*
|
||||
* @covers ::wp_handle_comment_submission
|
||||
*/
|
||||
public function test_submitting_comment_with_author_too_long_returns_error() {
|
||||
$error = 'comment_author_column_length';
|
||||
@ -757,8 +679,6 @@ class Tests_Comment_Submission extends WP_UnitTestCase {
|
||||
|
||||
/**
|
||||
* @ticket 10377
|
||||
*
|
||||
* @covers ::wp_handle_comment_submission
|
||||
*/
|
||||
public function test_submitting_comment_with_email_too_long_returns_error() {
|
||||
$error = 'comment_author_email_column_length';
|
||||
@ -777,8 +697,6 @@ class Tests_Comment_Submission extends WP_UnitTestCase {
|
||||
|
||||
/**
|
||||
* @ticket 10377
|
||||
*
|
||||
* @covers ::wp_handle_comment_submission
|
||||
*/
|
||||
public function test_submitting_comment_with_url_too_long_returns_error() {
|
||||
$error = 'comment_author_url_column_length';
|
||||
@ -798,8 +716,6 @@ class Tests_Comment_Submission extends WP_UnitTestCase {
|
||||
|
||||
/**
|
||||
* @ticket 49236
|
||||
*
|
||||
* @covers ::wp_handle_comment_submission
|
||||
*/
|
||||
public function test_submitting_comment_with_empty_type_results_in_correct_type() {
|
||||
$data = array(
|
||||
@ -841,8 +757,6 @@ class Tests_Comment_Submission extends WP_UnitTestCase {
|
||||
|
||||
/**
|
||||
* @ticket 34997
|
||||
*
|
||||
* @covers ::wp_handle_comment_submission
|
||||
*/
|
||||
public function test_comment_submission_sends_all_expected_parameters_to_preprocess_comment_filter() {
|
||||
$user = get_userdata( self::$author_id );
|
||||
@ -879,8 +793,6 @@ class Tests_Comment_Submission extends WP_UnitTestCase {
|
||||
|
||||
/**
|
||||
* @ticket 56712
|
||||
*
|
||||
* @covers ::wp_handle_comment_submission
|
||||
*/
|
||||
public function test_submitting_comment_without_optional_parameters_sets_them_to_empty_strings() {
|
||||
$data = array(
|
||||
@ -912,8 +824,6 @@ class Tests_Comment_Submission extends WP_UnitTestCase {
|
||||
|
||||
/**
|
||||
* @ticket 36901
|
||||
*
|
||||
* @covers ::wp_handle_comment_submission
|
||||
*/
|
||||
public function test_submitting_duplicate_comments() {
|
||||
$data = array(
|
||||
@ -930,8 +840,6 @@ class Tests_Comment_Submission extends WP_UnitTestCase {
|
||||
|
||||
/**
|
||||
* @ticket 36901
|
||||
*
|
||||
* @covers ::wp_handle_comment_submission
|
||||
*/
|
||||
public function test_comments_flood() {
|
||||
$data = array(
|
||||
@ -951,8 +859,6 @@ class Tests_Comment_Submission extends WP_UnitTestCase {
|
||||
|
||||
/**
|
||||
* @ticket 36901
|
||||
*
|
||||
* @covers ::wp_handle_comment_submission
|
||||
*/
|
||||
public function test_comments_flood_user_is_admin() {
|
||||
$user = self::factory()->user->create_and_get(
|
Loading…
x
Reference in New Issue
Block a user