QA: use the most specific PHPUnit assertion possible [2]#467
Open
QA: use the most specific PHPUnit assertion possible [2]#467
Conversation
This is a long established best practice. PHPUnit contains a variety of assertions and the ones available have been extended hugely over the years. To have the most reliable tests, the most specific assertion should be used. Most notably, this changes calls to `assertEmpty()` to different assertions as `assertEmpty()` is a completely type-loose assertion. Refs: * https://phpunit.de/manual/9.6/en/appendixes.assertions.html#appendixes.assertions.assertEmpty
Pull Request Test Coverage Report for Build 22267807042Details
💛 - Coveralls |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Context
Summary
This PR can be summarized in the following changelog entry:
Relevant technical choices:
This is a long established best practice.
PHPUnit contains a variety of assertions and the ones available have been extended hugely over the years.
To have the most reliable tests, the most specific assertion should be used.
Most notably, this changes calls to
assertEmpty()to different assertions asassertEmpty()is a completely type-loose assertion.Refs:
@enricobattocchi Tagging you as reviewer to verify that the updated assertions are documenting the intended behaviour of the application (and not accidental behaviour). Feel free to change/fix any assertions you deem incorrect.
Test instructions
Test instructions for the acceptance test before the PR gets merged
This PR can be acceptance tested by following these steps: