mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-07-01 15:50:09 +00:00
Media: revert the multi-mime feature.
This feature isn't quite ready to land. Reverts r53786, r53848, r53847, r53845, r53751. Props flixos90, azaozz, dd32. See #55443. git-svn-id: https://develop.svn.wordpress.org/trunk@54085 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -2262,46 +2262,4 @@ class WP_Test_REST_Attachments_Controller extends WP_Test_REST_Post_Type_Control
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @ticket 55443
|
||||
*/
|
||||
public function test_image_sources_to_rest_response() {
|
||||
|
||||
$attachment_id = self::factory()->attachment->create_upload_object( $this->test_file );
|
||||
$metadata = wp_get_attachment_metadata( $attachment_id );
|
||||
$request = new WP_REST_Request();
|
||||
$request['id'] = $attachment_id;
|
||||
$controller = new WP_REST_Attachments_Controller( 'attachment' );
|
||||
$response = $controller->get_item( $request );
|
||||
|
||||
$this->assertNotWPError( $response );
|
||||
|
||||
$data = $response->get_data();
|
||||
$mime_types = array(
|
||||
'image/jpeg',
|
||||
);
|
||||
|
||||
if ( wp_image_editor_supports( array( 'mime_type' => 'image/webp' ) ) ) {
|
||||
array_push( $mime_types, 'image/webp' );
|
||||
}
|
||||
|
||||
foreach ( $data['media_details']['sizes'] as $size_name => $properties ) {
|
||||
if ( ! isset( $metadata['sizes'][ $size_name ]['sources'] ) ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$this->assertArrayHasKey( 'sources', $properties );
|
||||
$this->assertIsArray( $properties['sources'] );
|
||||
|
||||
foreach ( $mime_types as $mime_type ) {
|
||||
$this->assertArrayHasKey( $mime_type, $properties['sources'] );
|
||||
$this->assertArrayHasKey( 'filesize', $properties['sources'][ $mime_type ] );
|
||||
$this->assertArrayHasKey( 'file', $properties['sources'][ $mime_type ] );
|
||||
$this->assertArrayHasKey( 'source_url', $properties['sources'][ $mime_type ] );
|
||||
$this->assertNotFalse( filter_var( $properties['sources'][ $mime_type ]['source_url'], FILTER_VALIDATE_URL ) );
|
||||
}
|
||||
}
|
||||
$this->assertArrayNotHasKey( 'sources', $data['media_details'] );
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user