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
{{ message }}
Repository navigation
Improved API for exception message expectations #6559
expectExceptionMessage() uses str_contains() to verify the exception message. This means that expectExceptionMessage('foo') also passes when the actual exception message is 'foobar'. There is currently no way to assert that the exception message is exactly a given string.
Introduce expectExceptionMessageIs() that uses === instead of str_contains() for exception message verification.
Additionally, introduce expectExceptionMessageIsOrContains() as an explicitly-named replacement for expectExceptionMessage() that preserves the current str_contains() behavior.
changed the title [-]`expectExceptionMessageIs()` for exact-match exception message expectations[/-][+]Improved API for exception message expectations[/+]on Apr 3, 2026
Activity
[-]`expectExceptionMessageIs()` for exact-match exception message expectations[/-][+]Improved API for exception message expectations[/+]Introduce expectExceptionMessageIs() and expectExceptionMessageIsOrCo…
Document sebastianbergmann/phpunit#6559 and sebastianbergmann/phpunit…