/** * @ticket 38477 */ public function test_update_comment_content_too_long() { wp_set_current_user(self::$admin_id); $params = array('content' => rand_long_str(66525)); $request = new WP_REST_Request('PUT', sprintf('/wp/v2/comments/%d', self::$approved_id)); $request->add_header('content-type', 'application/json'); $request->set_body(wp_json_encode($params)); $response = $this->server->dispatch($request); $this->assertErrorResponse('comment_content_column_length', $response, 400); }
/** * @ticket 10377 */ public function test_submitting_comment_with_url_too_long_returns_error() { $error = 'comment_author_url_column_length'; $post = self::factory()->post->create_and_get(); $data = array('comment_post_ID' => $post->ID, 'comment' => rand_str(), 'author' => 'Comment Author', 'email' => '*****@*****.**', 'url' => rand_long_str(201)); $comment = wp_handle_comment_submission($data); $this->assertWPError($comment); $this->assertSame($error, $comment->get_error_code()); }