Make WordPress Core

Changeset 61409


Ignore:
Timestamp:
12/26/2025 11:51:28 AM (5 months ago)
Author:
jonsurrell
Message:

Tests: Update fonts tests to use semantic HTML comparison.

This aims to make the tests more robust.

Follow-up to [60295], [61391], [61392].

Props jonsurrell.
See #64225.

Location:
trunk/tests/phpunit/tests/fonts/font-face
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/fonts/font-face/wpFontFace/generateAndPrint.php

    r59259 r61409  
    3535        $expected_output = sprintf( $style_element, $expected );
    3636
    37         $this->expectOutputString( $expected_output );
    38         $font_face->generate_and_print( $fonts );
     37        $output = get_echo( array( $font_face, 'generate_and_print' ), array( $fonts ) );
     38        $this->assertEqualHTML( $expected_output, $output );
    3939    }
    4040}
  • trunk/tests/phpunit/tests/fonts/font-face/wpPrintFontFaces.php

    r59259 r61409  
    3838        $expected_output = $this->get_expected_styles_output( $expected );
    3939
    40         $this->expectOutputString( $expected_output );
    41         wp_print_font_faces( $fonts );
     40        $output = get_echo( 'wp_print_font_faces', array( $fonts ) );
     41        $this->assertEqualHTML( $expected_output, $output );
    4242    }
    4343
     
    6161
    6262CSS;
    63         $this->expectOutputString( $expected_output );
    6463
    65         wp_print_font_faces( $fonts );
     64        $output = get_echo( 'wp_print_font_faces', array( $fonts ) );
     65        $this->assertEqualHTML( $expected_output, $output );
    6666    }
    6767
     
    7272        $expected_output = $this->get_expected_styles_output( $expected );
    7373
    74         $this->expectOutputString( $expected_output );
    75         wp_print_font_faces();
     74        $output = get_echo( 'wp_print_font_faces' );
     75        $this->assertEqualHTML( $expected_output, $output );
    7676    }
    7777
  • trunk/tests/phpunit/tests/fonts/font-face/wpPrintFontFacesFromStyleVariations.php

    r59260 r61409  
    4444        $expected_output = $this->get_expected_styles_output( $expected );
    4545
    46         $this->expectOutputString( $expected_output );
    47         wp_print_font_faces_from_style_variations();
     46        $output = get_echo( 'wp_print_font_faces_from_style_variations' );
     47        $this->assertEqualHTML( $expected_output, $output );
    4848    }
    4949
Note: See TracChangeset for help on using the changeset viewer.