Skip to content

Commit 6db003c

Browse files
committed
Media: Fix HEIF mime type assertion in test for PHP 8.5.
In PHP 8.5, the test image's mime type is now detected as `image/heif`, not `image/heic`. Props swissspidy, adamsilverstein. Fixes #64050. git-svn-id: https://develop.svn.wordpress.org/trunk@60810 602fd350-edb4-49c9-b593-d223f7449a82
1 parent ee22a18 commit 6db003c

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

tests/phpunit/tests/functions.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1284,7 +1284,11 @@ public function test_wp_get_image_mime( $file, $expected ) {
12841284
$this->markTestSkipped( 'The exif PHP extension is not loaded.' );
12851285
}
12861286

1287-
$this->assertSame( $expected, wp_get_image_mime( $file ) );
1287+
if ( is_array( $expected ) ) {
1288+
$this->assertContains( wp_get_image_mime( $file ), $expected );
1289+
} else {
1290+
$this->assertSame( $expected, wp_get_image_mime( $file ) );
1291+
}
12881292
}
12891293

12901294
/**
@@ -1360,7 +1364,8 @@ public function data_wp_get_image_mime() {
13601364
// HEIC.
13611365
array(
13621366
DIR_TESTDATA . '/images/test-image.heic',
1363-
'image/heic',
1367+
// In PHP 8.5, it returns 'image/heif'. Before that, it returns 'image/heic'.
1368+
array( 'image/heic', 'image/heif' ),
13641369
),
13651370
);
13661371

0 commit comments

Comments
 (0)