From 13e2780b5938002e049334504073f2151a65d5b2 Mon Sep 17 00:00:00 2001 From: Jeremy Felt Date: Tue, 25 Oct 2016 19:33:34 +0000 Subject: [PATCH] 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 --- .../phpunit/tests/rest-api/rest-attachments-controller.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/phpunit/tests/rest-api/rest-attachments-controller.php b/tests/phpunit/tests/rest-api/rest-attachments-controller.php index 9eef1e2584..86f45a6050 100644 --- a/tests/phpunit/tests/rest-api/rest-attachments-controller.php +++ b/tests/phpunit/tests/rest-api/rest-attachments-controller.php @@ -280,7 +280,7 @@ class WP_Test_REST_Attachments_Controller extends WP_Test_REST_Post_Type_Control $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 ); $this->factory->attachment->create_object( $this->test_file, 0, array( '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' ); $response = $this->server->dispatch( $request ); $data = $response->get_data(); - $this->assertCount( 1, $data ); - $this->assertEquals( 'inherit', $data[0]['status'] ); + $this->assertCount( 3, $data ); + $this->assertEquals( 'rest_invalid_param', $data['code'] ); } public function test_get_items_private_status() {