You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This functionality resembles the functionality previously offered by the `TestCase::expectDeprecationMessage()` and `TestCase::expectDeprecationMessageMatches()` methods, which were removed in PHPUnit 10.0.0.
455
+
456
+
The polyfill use the old methods under the hood for PHPUnit <= 9, however, there are some pertinent differences in behaviour between the old and the new methods, which users of the polyfill should be aware of.
457
+
458
+
| PHPUnit <= 9.x | PHPUnit >= 11.0 |
459
+
| -------------- | --------------- |
460
+
| Only one deprecation can be expected per test | Multiple deprecations can be expected per test |
461
+
| The test stops running as soon as the deprecation message has been seen | The test will be executed completely, independently of the deprecation notice |
462
+
| The message passed to `expectUserDeprecationMessage()` will be compared as a substring | The message passed to `expectUserDeprecationMessage()` must be an exact match |
463
+
| Can expect both PHP native and user-land deprecation notices | Can only expect user-land deprecation notices, i.e. `E_USER_DEPRECATED`, not `E_DEPRECATED`|
464
+
465
+
Please keep these differences in mind when writing tests using the `expectUserDeprecationMessage*()` methods.
466
+
467
+
Note: on PHPUnit 9.5.x, when using the `expectUserDeprecationMessage*()` expectations, a "_Expecting E_DEPRECATED and E_USER_DEPRECATED is deprecated and will no longer be possible in PHPUnit 10._" deprecation will be shown in the test output.
468
+
As long at the actual test uses the `expectUserDeprecationMessage*()` expectations, this depreation message can be safely ignored.
469
+
470
+
> :information_source: Important: when using the `expectUserDeprecationMessage*()` expectation(s) in a test, the test should be annotated with a [`#[IgnoreDeprecations]`][ignoredeprecations-attribute] attribute.
0 commit comments