Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Polyfills: improve handling of custom error message #97

Merged
merged 3 commits into from
Mar 12, 2023

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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant