Skip to content

Commit

Permalink
TRAC 46149 void | WAIT FOR 47381 + 46149 Ass | Tests: replace `expect…
Browse files Browse the repository at this point in the history
…Exception()` for PHP native errors

... with calls to the dedicated PHPUnit 8.4.0+ methods.

The old manner of testing these is soft deprecated as of PHPUnit  8.4, hard deprecated as of PHPUnit 9.0 and will be removed in PHPUnit 10.0.0.

Most calls like this were already replaced in the patch which introduced the PHPUnit Polyfills, however, this particular one could not be changed yet due to the mismatch between the PHPUnit version and the PHP version on which the tests were being run.
Fixed now anyway.

Ref:
* https://github.com/sebastianbergmann/phpunit/blob/8.4.3/ChangeLog-8.4.md#840---2019-10-04
* sebastianbergmann/phpunit#3775
  • Loading branch information
jrfnl committed Aug 6, 2021
1 parent 8f8b9a3 commit b25eac2
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions tests/phpunit/tests/dependencies/scripts.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
}

Expand Down

0 comments on commit b25eac2

Please sign in to comment.