diff --git a/tests/phpunit/tests/dependencies/scripts.php b/tests/phpunit/tests/dependencies/scripts.php index 2b385e733d694..2863a5ec9b535 100644 --- a/tests/phpunit/tests/dependencies/scripts.php +++ b/tests/phpunit/tests/dependencies/scripts.php @@ -1426,12 +1426,7 @@ public function test_wp_localize_script_data_formats( $l10n_data, $expected, $wa if ( PHP_VERSION_ID < 80000 ) { $this->expectWarning(); } else { - /* - * As this exception will only be set on PHP 8 in combination with PHPUnit 7, this will work (for now). - * Once the PHPUnit version constraints have been widened and a _supported_ PHPUnit version is - * used to run the tests on PHP 8.x, this should be changed to `$this->expectError()`. - */ - $this->expectException( 'Error' ); + $this->expectError(); } }