Changeset 55498
- Timestamp:
- 03/09/2023 02:04:51 PM (20 months ago)
- Location:
- branches/5.9
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/5.9
-
branches/5.9/tests/phpunit/tests/functions.php
r52328 r55498 1444 1444 ); 1445 1445 1446 add_filter( 'upload_mimes', array( $this, 'filter_mime_types_svg' ) ); 1446 add_filter( 1447 'upload_mimes', 1448 static function( $mimes ) { 1449 $mimes['svg'] = 'image/svg+xml'; 1450 return $mimes; 1451 } 1452 ); 1453 1447 1454 $this->assertSame( $expected, wp_check_filetype_and_ext( $file, $filename ) ); 1448 1449 // Cleanup.1450 remove_filter( 'upload_mimes', array( $this, 'filter_mime_types_svg' ) );1451 1455 } 1452 1456 … … 1460 1464 $filename = 'dashicons.woff'; 1461 1465 1466 $woff_mime_type = 'application/font-woff'; 1467 1468 /* 1469 * As of PHP 8.1.12, which includes libmagic/file update to version 5.42, 1470 * the expected mime type for WOFF files is 'font/woff'. 1471 * 1472 * See https://github.com/php/php-src/issues/8805. 1473 */ 1474 if ( PHP_VERSION_ID >= 80112 ) { 1475 $woff_mime_type = 'font/woff'; 1476 } 1477 1462 1478 $expected = array( 1463 1479 'ext' => 'woff', 1464 'type' => 'application/font-woff',1480 'type' => $woff_mime_type, 1465 1481 'proper_filename' => false, 1466 1482 ); 1467 1483 1468 add_filter( 'upload_mimes', array( $this, 'filter_mime_types_woff' ) ); 1484 add_filter( 1485 'upload_mimes', 1486 static function( $mimes ) use ( $woff_mime_type ) { 1487 $mimes['woff'] = $woff_mime_type; 1488 return $mimes; 1489 } 1490 ); 1491 1469 1492 $this->assertSame( $expected, wp_check_filetype_and_ext( $file, $filename ) ); 1470 1471 // Cleanup.1472 remove_filter( 'upload_mimes', array( $this, 'filter_mime_types_woff' ) );1473 }1474 1475 public function filter_mime_types_svg( $mimes ) {1476 $mimes['svg'] = 'image/svg+xml';1477 return $mimes;1478 }1479 1480 public function filter_mime_types_woff( $mimes ) {1481 $mimes['woff'] = 'application/font-woff';1482 return $mimes;1483 1493 } 1484 1494
Note: See TracChangeset
for help on using the changeset viewer.