Skip to content

Polyfills: improve handling of custom error message#97

Merged
jrfnl merged 3 commits intodevelopfrom
feature/improve-error-messages
Mar 12, 2023
Merged

Polyfills: improve handling of custom error message#97
jrfnl merged 3 commits intodevelopfrom
feature/improve-error-messages

Conversation

@jrfnl
Copy link
Collaborator

@jrfnl jrfnl commented Mar 12, 2023

AssertClosedResource: improve handling of custom error message

The assertions in the AssertClosedResource trait generate a specific error message.
However, if a custom $message parameter was passed, that message would not be displayed and only the custom $message would be shown when the assertion failed.

As the PHPUnit native error message from the underlying assertion used - "true is not false" - would be obscuring the real issue, this commit adjusts the code to always display the assertion specific error message as well.

Includes tests safeguarding the fix.

AssertFileDirectory: improve handling of custom error message

Some of the assertions in the AssertFileDirectory trait generate a specific error message.
However, if a custom $message parameter was passed, that message would not be displayed and only the custom $message would be shown when the assertion failed.

As the PHPUnit native error message from the underlying assertion used - "true is not false" - would be obscuring the real issue, this commit adjusts the code to always display the assertion specific error message as well.

Includes tests safeguarding the fix.

AssertStringContains: improve handling of custom error message

Some of the assertions in the AssertStringContains trait generate a specific error message.
However, if a custom $message parameter was passed, that message would not be displayed and only the custom $message would be shown when the assertion failed.

As the PHPUnit native error message from the underlying assertion used - "true is not false" - would be obscuring the real issue, this commit adjusts the code to always display the assertion specific error message as well.

Includes tests safeguarding the fix.

jrfnl added 3 commits March 12, 2023 20:06
The assertions in the `AssertClosedResource` trait generate a specific error message.
However, if a custom `$message` parameter was passed, that message would not be displayed and only the custom `$message` would be shown when the assertion failed.

As the PHPUnit native error message from the _underlying_ assertion used - _"true is not false"_ - would be obscuring the real issue, this commit adjusts the code to always display the assertion specific error message as well.

Includes tests safeguarding the fix.
Some of the assertions in the `AssertFileDirectory` trait generate a specific error message.
However, if a custom `$message` parameter was passed, that message would not be displayed and only the custom `$message` would be shown when the assertion failed.

As the PHPUnit native error message from the _underlying_ assertion used - _"true is not false"_ - would be obscuring the real issue, this commit adjusts the code to always display the assertion specific error message as well.

Includes tests safeguarding the fix.
Some of the assertions in the `AssertStringContains` trait generate a specific error message.
However, if a custom `$message` parameter was passed, that message would not be displayed and only the custom `$message` would be shown when the assertion failed.

As the PHPUnit native error message from the _underlying_ assertion used - _"true is not false"_ - would be obscuring the real issue, this commit adjusts the code to always display the assertion specific error message as well.

Includes tests safeguarding the fix.
@jrfnl jrfnl added this to the 1.x Next milestone Mar 12, 2023
@jrfnl jrfnl enabled auto-merge March 12, 2023 19:14
@jrfnl jrfnl merged commit 981b266 into develop Mar 12, 2023
@jrfnl jrfnl deleted the feature/improve-error-messages branch March 12, 2023 19:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment