REST API: Adjust test_get_items_invalid_status_param_is_discarded() after [38911].

Previously, if an invalid post status was assigned to a media object, the object would be returned with an unchanged status. After [38911], an error response is returned.

The assertion in test_get_items_invalid_status_param_is_discarded() needs to be updated to account for the expected error response. The test name has been changed to `test_get_items_invalid_status_param_is_error_response()`.

Fixes #38417.


git-svn-id: https://develop.svn.wordpress.org/trunk@38917 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Jeremy Felt 2016-10-25 19:33:34 +00:00
parent 1c034393f0
commit 13e2780b59

View File

@ -280,7 +280,7 @@ class WP_Test_REST_Attachments_Controller extends WP_Test_REST_Post_Type_Control
$this->assertEquals( 0, count( $data ) ); $this->assertEquals( 0, count( $data ) );
} }
public function test_get_items_invalid_status_param_is_discarded() { public function test_get_items_invalid_status_param_is_error_response() {
wp_set_current_user( $this->editor_id ); wp_set_current_user( $this->editor_id );
$this->factory->attachment->create_object( $this->test_file, 0, array( $this->factory->attachment->create_object( $this->test_file, 0, array(
'post_mime_type' => 'image/jpeg', 'post_mime_type' => 'image/jpeg',
@ -291,8 +291,8 @@ class WP_Test_REST_Attachments_Controller extends WP_Test_REST_Post_Type_Control
$request->set_param( 'context', 'edit' ); $request->set_param( 'context', 'edit' );
$response = $this->server->dispatch( $request ); $response = $this->server->dispatch( $request );
$data = $response->get_data(); $data = $response->get_data();
$this->assertCount( 1, $data ); $this->assertCount( 3, $data );
$this->assertEquals( 'inherit', $data[0]['status'] ); $this->assertEquals( 'rest_invalid_param', $data['code'] );
} }
public function test_get_items_private_status() { public function test_get_items_private_status() {