From 5a8a203a322c5d4844b098be35ee3efefb0589f7 Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers <359867+desrosj@users.noreply.github.com> Date: Mon, 16 Nov 2026 14:47:43 -0500 Subject: [PATCH] Tests: Remove TrueType font detection skips for PHP 8.6. The upstream libmagic regression that caused TrueType fonts to be detected as `application/octet-stream` has been fixed in PHP 8.6.0RC7, which now correctly reports `font/ttf`. The conditional skips added to account for this are no longer necessary. Follow-up to [65319]. See #66419. Co-Authored-By: Claude Opus 5.5 --- .../font-library/wpRestFontFacesController.php | 17 ++--------------- tests/phpunit/tests/functions.php | 5 ----- 2 files changed, 2 insertions(+), 20 deletions(-) diff --git a/tests/phpunit/tests/fonts/font-library/wpRestFontFacesController.php b/tests/phpunit/tests/fonts/font-library/wpRestFontFacesController.php index 2a2026ccf2458..05af011f5cf0a 100644 --- a/tests/phpunit/tests/fonts/font-library/wpRestFontFacesController.php +++ b/tests/phpunit/tests/fonts/font-library/wpRestFontFacesController.php @@ -463,20 +463,7 @@ function ( $font_dir ) { */ public function test_create_item_with_multiple_font_files() { wp_set_current_user( self::$admin_id ); - - $formats = array( 'ttf', 'otf', 'woff', 'woff2' ); - - /* - * Some libmagic versions cannot detect TrueType fonts and report them as - * application/octet-stream, which causes the upload to be rejected. - * - * @link https://github.com/php/php-src/issues/25051 - */ - if ( 'application/octet-stream' === finfo_file( finfo_open( FILEINFO_MIME_TYPE ), DIR_TESTDATA . '/fonts/OpenSans-Regular.ttf' ) ) { - $formats = array_diff( $formats, array( 'ttf' ) ); - } - - $files = $this->setup_font_file_upload( $formats ); + $files = $this->setup_font_file_upload( array( 'ttf', 'otf', 'woff', 'woff2' ) ); $request = new WP_REST_Request( 'POST', '/wp/v2/font-families/' . self::$font_family_id . '/font-faces' ); $request->set_param( 'theme_json_version', WP_REST_Font_Faces_Controller::LATEST_THEME_JSON_VERSION_SUPPORTED ); @@ -501,7 +488,7 @@ public function test_create_item_with_multiple_font_files() { $this->check_file_meta( $data['id'], $data['font_face_settings']['src'] ); $settings = $data['font_face_settings']; - $this->assertCount( count( $files ), $settings['src'], 'There should be one item in the font_face_settings::src data for each uploaded file.' ); + $this->assertCount( 4, $settings['src'], 'There should be 4 items in the font_face_settings::src data.' ); } /** diff --git a/tests/phpunit/tests/functions.php b/tests/phpunit/tests/functions.php index 9e04db504de13..51419799dbd16 100644 --- a/tests/phpunit/tests/functions.php +++ b/tests/phpunit/tests/functions.php @@ -1910,11 +1910,6 @@ public function test_wp_check_filetype_and_ext_accepts_either_ttf_mime_type( $mi $file = DIR_TESTDATA . '/fonts/OpenSans-Regular.ttf'; $filename = 'OpenSans-Regular.ttf'; - $detected_type = finfo_file( finfo_open( FILEINFO_MIME_TYPE ), $file ); - if ( ! in_array( $detected_type, array( 'font/ttf', 'font/sfnt' ), true ) ) { - $this->markTestSkipped( "This version of libmagic detects TrueType fonts as {$detected_type}." ); - } - $filter = static function ( $mimes ) use ( $mime_type ) { $mimes['ttf'] = $mime_type; return $mimes;