- Timestamp:
- 07/13/2018 06:50:51 AM (7 years ago)
- Location:
- branches/4.9
- Files:
-
- 2 edited
-
. (modified) (1 prop)
-
tests/phpunit/tests/rest-api/rest-attachments-controller.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
branches/4.9
-
branches/4.9/tests/phpunit/tests/rest-api/rest-attachments-controller.php
r43438 r43445 1075 1075 } 1076 1076 1077 public function test_prepare_item_limit_fields() { 1078 $attachment_id = $this->factory->attachment->create_object( 1079 $this->test_file, 0, array( 1080 'post_mime_type' => 'image/jpeg', 1081 'post_excerpt' => 'A sample caption', 1082 'post_author' => self::$editor_id, 1083 ) 1084 ); 1085 wp_set_current_user( self::$editor_id ); 1086 $endpoint = new WP_REST_Attachments_Controller( 'post' ); 1087 $request = new WP_REST_Request( 'GET', sprintf( '/wp/v2/media/%d', $attachment_id ) ); 1088 $request->set_param( 'context', 'edit' ); 1089 $request->set_param( '_fields', 'id,slug' ); 1090 $obj = get_post( $attachment_id ); 1091 $response = $endpoint->prepare_item_for_response( $obj, $request ); 1092 $this->assertEquals( array( 1093 'id', 1094 'slug', 1095 ), array_keys( $response->get_data() ) ); 1096 } 1097 1077 1098 public function test_get_item_schema() { 1078 1099 $request = new WP_REST_Request( 'OPTIONS', '/wp/v2/media' );
Note: See TracChangeset
for help on using the changeset viewer.