Skip to content

Commit eea07d2

Browse files
Tests: Use HEIC fixture and convert_format=false for original-heic sideload.
The test was sending JPEG bytes with a .heic filename, which wp_check_filetype_and_ext() corrected to canola-1.jpg before the metadata assertion ran. Switch to the real test-image.heic fixture, set Content-Type accordingly, and pass convert_format=false to disable the default HEIC -> JPEG output mapping so the .heic extension is preserved.
1 parent b20bbca commit eea07d2

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

tests/phpunit/tests/rest-api/rest-attachments-controller.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3408,13 +3408,15 @@ public function test_sideload_original_heic_writes_metadata_original() {
34083408

34093409
$this->assertSame( 201, $response->get_status() );
34103410

3411-
// Sideload the HEIC companion. Uses a JPEG body since the size enum,
3412-
// not the file format, is what we're exercising here.
3411+
// Sideload the HEIC companion using the real HEIC fixture. `convert_format`
3412+
// is disabled so the default HEIC -> JPEG output mapping does not rename
3413+
// the file or append an alt-extension suffix.
34133414
$request = new WP_REST_Request( 'POST', "/wp/v2/media/{$attachment_id}/sideload" );
3414-
$request->set_header( 'Content-Type', 'image/jpeg' );
3415+
$request->set_header( 'Content-Type', 'image/heic' );
34153416
$request->set_header( 'Content-Disposition', 'attachment; filename=canola.heic' );
34163417
$request->set_param( 'image_size', 'original-heic' );
3417-
$request->set_body( file_get_contents( self::$test_file ) );
3418+
$request->set_param( 'convert_format', false );
3419+
$request->set_body( file_get_contents( DIR_TESTDATA . '/images/test-image.heic' ) );
34183420
$response = rest_get_server()->dispatch( $request );
34193421

34203422
$this->assertSame( 200, $response->get_status(), 'Sideloading original-heic should succeed.' );

0 commit comments

Comments
 (0)