Make WordPress Core

Changeset 65539


Ignore:
Timestamp:
11/17/2026 01:38:09 AM (36 hours ago)
Author:
desrosj
Message:

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].

Fixes #66419.

Location:
trunk/tests/phpunit/tests
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/fonts/font-library/wpRestFontFacesController.php

    r65319 r65539  
    464464        public function test_create_item_with_multiple_font_files() {
    465465                wp_set_current_user( self::$admin_id );
    466 
    467                 $formats = array( 'ttf', 'otf', 'woff', 'woff2' );
    468 
    469                 /*
    470                  * Some libmagic versions cannot detect TrueType fonts and report them as
    471                  * application/octet-stream, which causes the upload to be rejected.
    472                  *
    473                  * @link https://github.com/php/php-src/issues/25051
    474                  */
    475                 if ( 'application/octet-stream' === finfo_file( finfo_open( FILEINFO_MIME_TYPE ), DIR_TESTDATA . '/fonts/OpenSans-Regular.ttf' ) ) {
    476                         $formats = array_diff( $formats, array( 'ttf' ) );
    477                 }
    478 
    479                 $files = $this->setup_font_file_upload( $formats );
     466                $files = $this->setup_font_file_upload( array( 'ttf', 'otf', 'woff', 'woff2' ) );
    480467
    481468                $request = new WP_REST_Request( 'POST', '/wp/v2/font-families/' . self::$font_family_id . '/font-faces' );
    … …  
    502489
    503490                $settings = $data['font_face_settings'];
    504                 $this->assertCount( count( $files ), $settings['src'], 'There should be one item in the font_face_settings::src data for each uploaded file.' );
     491                $this->assertCount( 4, $settings['src'], 'There should be 4 items in the font_face_settings::src data.' );
    505492        }
    506493
  • trunk/tests/phpunit/tests/functions.php

    r65340 r65539  
    19111911                $filename = 'OpenSans-Regular.ttf';
    19121912
    1913                 $detected_type = finfo_file( finfo_open( FILEINFO_MIME_TYPE ), $file );
    1914                 if ( ! in_array( $detected_type, array( 'font/ttf', 'font/sfnt' ), true ) ) {
    1915                         $this->markTestSkipped( "This version of libmagic detects TrueType fonts as {$detected_type}." );
    1916                 }
    1917 
    19181913                $filter = static function ( $mimes ) use ( $mime_type ) {
    19191914                        $mimes['ttf'] = $mime_type;
Note: See TracChangeset for help on using the changeset viewer.