mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-10-06 15:47:05 +00:00
REST API: Validate posts status enum
Currently we are using a different validate callback, so the `enum` is not interpretted. We just have to fallback to the result of `rest_validate_request_arg` in our custom wrapper function. Fixes #38417. git-svn-id: https://develop.svn.wordpress.org/trunk@38911 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -240,6 +240,14 @@ class WP_Test_REST_Posts_Controller extends WP_Test_REST_Post_Type_Controller_Te
|
||||
$this->assertEquals( 1, count( $response->get_data() ) );
|
||||
}
|
||||
|
||||
public function test_get_items_invalid_status_query() {
|
||||
wp_set_current_user( 0 );
|
||||
$request = new WP_REST_Request( 'GET', '/wp/v2/posts' );
|
||||
$request->set_param( 'status', 'invalid' );
|
||||
$response = $this->server->dispatch( $request );
|
||||
$this->assertErrorResponse( 'rest_invalid_param', $response, 400 );
|
||||
}
|
||||
|
||||
public function test_get_items_status_without_permissions() {
|
||||
$draft_id = $this->factory->post->create( array(
|
||||
'post_status' => 'draft',
|
||||
|
||||
Reference in New Issue
Block a user