Make WordPress Core

Changeset 57332


Ignore:
Timestamp:
01/23/2024 08:57:48 AM (11 months ago)
Author:
youknowriad
Message:

Editor: Ensure PHPUnit10 compatibility for ThemeJson unit test.

Expecting E_STRICT, E_NOTICE, and E_USER_NOTICE errors is deprecated in PHPUnit 10.
This updates the test to rely on an exception instead.

Props antonvlasenko.
Fixes #60305.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/theme/wpThemeJson.php

    r57254 r57332  
    42824282     */
    42834283    public function test_set_spacing_sizes_should_detect_invalid_spacing_scale( $spacing_scale, $expected_output ) {
    4284         $this->expectNotice();
    4285         $this->expectNoticeMessage( 'Some of the theme.json settings.spacing.spacingScale values are invalid' );
     4284        $this->expectException( Exception::class );
     4285        $this->expectExceptionMessage( 'Some of the theme.json settings.spacing.spacingScale values are invalid' );
    42864286
    42874287        $theme_json = new WP_Theme_JSON(
     
    42944294                ),
    42954295            )
     4296        );
     4297
     4298        // Ensure PHPUnit 10 compatibility.
     4299        set_error_handler(
     4300            static function ( $errno, $errstr ) {
     4301                restore_error_handler();
     4302                throw new Exception( $errstr, $errno );
     4303            },
     4304            E_ALL
    42964305        );
    42974306
Note: See TracChangeset for help on using the changeset viewer.