mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-03-30 18:24:31 +00:00
REST API: On comment create, return an error if the post parameter does not relate to a valid WP_Post object.
Return a `WP_Error` object for attempts to create a comment without an empty or invalid `post` ID. Props dd32, jnylen0, rachelbaker. Fixes #38816. git-svn-id: https://develop.svn.wordpress.org/trunk@39288 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -1306,7 +1306,8 @@ class WP_Test_REST_Comments_Controller extends WP_Test_REST_Controller_Testcase
|
||||
$request->set_body( wp_json_encode( $params ) );
|
||||
|
||||
$response = $this->server->dispatch( $request );
|
||||
$this->assertEquals( 201, $response->get_status() );
|
||||
|
||||
$this->assertErrorResponse( 'rest_comment_invalid_post_id', $response, 403 );
|
||||
}
|
||||
|
||||
public function test_create_comment_no_post_id_no_permission() {
|
||||
|
||||
Reference in New Issue
Block a user