mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-07-04 17:20:07 +00:00
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. git-svn-id: https://develop.svn.wordpress.org/trunk@57332 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -4281,8 +4281,8 @@ class Tests_Theme_wpThemeJson extends WP_UnitTestCase {
|
||||
* @param array $expected_output Expected output from data provider.
|
||||
*/
|
||||
public function test_set_spacing_sizes_should_detect_invalid_spacing_scale( $spacing_scale, $expected_output ) {
|
||||
$this->expectNotice();
|
||||
$this->expectNoticeMessage( 'Some of the theme.json settings.spacing.spacingScale values are invalid' );
|
||||
$this->expectException( Exception::class );
|
||||
$this->expectExceptionMessage( 'Some of the theme.json settings.spacing.spacingScale values are invalid' );
|
||||
|
||||
$theme_json = new WP_Theme_JSON(
|
||||
array(
|
||||
@@ -4295,6 +4295,15 @@ class Tests_Theme_wpThemeJson extends WP_UnitTestCase {
|
||||
)
|
||||
);
|
||||
|
||||
// Ensure PHPUnit 10 compatibility.
|
||||
set_error_handler(
|
||||
static function ( $errno, $errstr ) {
|
||||
restore_error_handler();
|
||||
throw new Exception( $errstr, $errno );
|
||||
},
|
||||
E_ALL
|
||||
);
|
||||
|
||||
$theme_json->set_spacing_sizes();
|
||||
$this->assertSame( $expected_output, _wp_array_get( $theme_json->get_raw_data(), array( 'settings', 'spacing', 'spacingSizes', 'default' ) ) );
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user