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

[TASK] Trigger assertion in assertCSVDataSet() on empty table #653

Merged
merged 1 commit into from
Nov 26, 2024
Merged

Conversation

lolli42
Copy link
Member

@lolli42 lolli42 commented Nov 26, 2024

When comparing with a csv fixture that contains a table with no rows, which is a legit case, no assertion is raised. This makes phpunit emit a risky test: "This test did not perform any assertions". The patch adds an assertion in this case as well.

Note phpunit nowadays has attribute #[DoesNotPerformAssertions] to mark tests that do not assert anything. This can be used for tests that for instance just call a subject method to verify no exception is raised. It is good to follow this path, the patch removes "beStrictAboutTestsThatDoNotTestAnything=false" from the example phpunit xml files, which makes this setting implicitly true.

Releases: main
Resolves: #647

When comparing with a csv fixture that contains a table
with no rows, which is a legit case, no assertion is
raised. This makes phpunit emit a risky test: "This test
did not perform any assertions". The patch adds an
assertion in this case as well.

Note phpunit nowadays has attribute #[DoesNotPerformAssertions]
to mark tests that do not assert anything. This can be used
for tests that for instance just call a subject method to verify
no exception is raised. It is good to follow this path, the
patch removes "beStrictAboutTestsThatDoNotTestAnything=false"
from the example phpunit xml files, which makes this setting
implicitly true.

Releases: main
Resolves: #647
@lolli42 lolli42 merged commit f31a26f into main Nov 26, 2024
6 checks passed
@lolli42 lolli42 deleted the lolli-1 branch November 26, 2024 21:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

assertCSVDataSet does not assert anything if green
1 participant