Changeset 55462
- Timestamp:
- 03/06/2023 12:39:18 PM (20 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/functions.php
r55209 r55462 1392 1392 ); 1393 1393 1394 add_filter( 'upload_mimes', array( $this, 'filter_mime_types_svg' ) ); 1394 add_filter( 1395 'upload_mimes', 1396 static function( $mimes ) { 1397 $mimes['svg'] = 'image/svg+xml'; 1398 return $mimes; 1399 } 1400 ); 1401 1395 1402 $this->assertSame( $expected, wp_check_filetype_and_ext( $file, $filename ) ); 1396 1397 // Cleanup.1398 remove_filter( 'upload_mimes', array( $this, 'filter_mime_types_svg' ) );1399 1403 } 1400 1404 … … 1405 1409 */ 1406 1410 public function test_wp_check_filetype_and_ext_with_filtered_woff() { 1407 if ( PHP_VERSION_ID >= 80100 ) {1408 /*1409 * For the time being, this test is marked skipped on PHP 8.1+ as a recent change introduced1410 * an inconsistency with how the mime-type for WOFF files are handled compared to older versions.1411 *1412 * See https://core.trac.wordpress.org/ticket/56817 for more details.1413 */1414 $this->markTestSkipped( 'This test currently fails on PHP 8.1+ and requires further investigation.' );1415 }1416 1417 1411 $file = DIR_TESTDATA . '/uploads/dashicons.woff'; 1418 1412 $filename = 'dashicons.woff'; 1419 1413 1414 $woff_mime_type = 'application/font-woff'; 1415 1416 /* 1417 * As of PHP 8.1.12, which includes libmagic/file update to version 5.42, 1418 * the expected mime type for WOFF files is 'font/woff'. 1419 * 1420 * See https://github.com/php/php-src/issues/8805. 1421 */ 1422 if ( PHP_VERSION_ID >= 80112 ) { 1423 $woff_mime_type = 'font/woff'; 1424 } 1425 1420 1426 $expected = array( 1421 1427 'ext' => 'woff', 1422 'type' => 'application/font-woff',1428 'type' => $woff_mime_type, 1423 1429 'proper_filename' => false, 1424 1430 ); 1425 1431 1426 add_filter( 'upload_mimes', array( $this, 'filter_mime_types_woff' ) ); 1432 add_filter( 1433 'upload_mimes', 1434 static function( $mimes ) use ( $woff_mime_type ) { 1435 $mimes['woff'] = $woff_mime_type; 1436 return $mimes; 1437 } 1438 ); 1439 1427 1440 $this->assertSame( $expected, wp_check_filetype_and_ext( $file, $filename ) ); 1428 1429 // Cleanup.1430 remove_filter( 'upload_mimes', array( $this, 'filter_mime_types_woff' ) );1431 }1432 1433 public function filter_mime_types_svg( $mimes ) {1434 $mimes['svg'] = 'image/svg+xml';1435 return $mimes;1436 }1437 1438 public function filter_mime_types_woff( $mimes ) {1439 $mimes['woff'] = 'application/font-woff';1440 return $mimes;1441 1441 } 1442 1442
Note: See TracChangeset
for help on using the changeset viewer.