Changeset 55497
- Timestamp:
- 03/09/2023 02:04:12 PM (13 months ago)
- Location:
- branches/6.0
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/6.0
-
branches/6.0/tests/phpunit/tests/functions.php
r53129 r55497 1476 1476 ); 1477 1477 1478 add_filter( 'upload_mimes', array( $this, 'filter_mime_types_svg' ) ); 1478 add_filter( 1479 'upload_mimes', 1480 static function( $mimes ) { 1481 $mimes['svg'] = 'image/svg+xml'; 1482 return $mimes; 1483 } 1484 ); 1485 1479 1486 $this->assertSame( $expected, wp_check_filetype_and_ext( $file, $filename ) ); 1480 1481 // Cleanup.1482 remove_filter( 'upload_mimes', array( $this, 'filter_mime_types_svg' ) );1483 1487 } 1484 1488 … … 1492 1496 $filename = 'dashicons.woff'; 1493 1497 1498 $woff_mime_type = 'application/font-woff'; 1499 1500 /* 1501 * As of PHP 8.1.12, which includes libmagic/file update to version 5.42, 1502 * the expected mime type for WOFF files is 'font/woff'. 1503 * 1504 * See https://github.com/php/php-src/issues/8805. 1505 */ 1506 if ( PHP_VERSION_ID >= 80112 ) { 1507 $woff_mime_type = 'font/woff'; 1508 } 1509 1494 1510 $expected = array( 1495 1511 'ext' => 'woff', 1496 'type' => 'application/font-woff',1512 'type' => $woff_mime_type, 1497 1513 'proper_filename' => false, 1498 1514 ); 1499 1515 1500 add_filter( 'upload_mimes', array( $this, 'filter_mime_types_woff' ) ); 1516 add_filter( 1517 'upload_mimes', 1518 static function( $mimes ) use ( $woff_mime_type ) { 1519 $mimes['woff'] = $woff_mime_type; 1520 return $mimes; 1521 } 1522 ); 1523 1501 1524 $this->assertSame( $expected, wp_check_filetype_and_ext( $file, $filename ) ); 1502 1503 // Cleanup.1504 remove_filter( 'upload_mimes', array( $this, 'filter_mime_types_woff' ) );1505 }1506 1507 public function filter_mime_types_svg( $mimes ) {1508 $mimes['svg'] = 'image/svg+xml';1509 return $mimes;1510 }1511 1512 public function filter_mime_types_woff( $mimes ) {1513 $mimes['woff'] = 'application/font-woff';1514 return $mimes;1515 1525 } 1516 1526
Note: See TracChangeset
for help on using the changeset viewer.