- Timestamp:
- 12/21/2016 05:18:24 AM (8 years ago)
- Location:
- branches/4.7
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/4.7
-
branches/4.7/tests/phpunit/tests/rest-api/rest-attachments-controller.php
r39610 r39629 1157 1157 } 1158 1158 1159 public function test_search_item_by_filename() { 1160 $id = $this->factory->attachment->create_object( $this->test_file, 0, array( 1161 'post_mime_type' => 'image/jpeg', 1162 ) ); 1163 $id2 = $this->factory->attachment->create_object( $this->test_file2, 0, array( 1164 'post_mime_type' => 'image/png', 1165 ) ); 1166 1167 $filename = basename( $this->test_file2 ); 1168 1169 $request = new WP_REST_Request( 'GET', '/wp/v2/media' ); 1170 $request->set_param( 'search', $filename ); 1171 $response = $this->server->dispatch( $request ); 1172 $data = $response->get_data(); 1173 1174 $this->assertCount( 1, $data ); 1175 $this->assertEquals( $id2, $data[0]['id'] ); 1176 $this->assertEquals( 'image/png', $data[0]['mime_type'] ); 1177 } 1178 1159 1179 public function additional_field_get_callback( $object, $request ) { 1160 1180 return 123;
Note: See TracChangeset
for help on using the changeset viewer.