test: replace checkbox assertions with real assertions or DoesNotPerformAssertions#60742
Merged
Merged
Conversation
This was referenced May 26, 2026
miaulalala
added a commit
that referenced
this pull request
May 26, 2026
… (middleware) Replace `addToAssertionCount(1)` placeholders in AppFramework middleware tests that only verify no exception is thrown. For `SameSiteCookieMiddlewareTest`, two tests already have `expects(self::once())` mock expectations as their real assertion — those just have the redundant placeholder removed. The third test has no expectations and gets `#[DoesNotPerformAssertions]`. For `SecurityMiddlewareTest`, `testIsSubAdminCheck` and `testIsSubAdminAndAdminCheck` get `#[DoesNotPerformAssertions]`. `testRestrictedAppLoggedInPublicPage` and `testRestrictedAppNotLoggedInPublicPage` have `->with()` argument constraints that count as assertions in PHPUnit 11, so the redundant placeholder is simply removed. Part of a broader effort to eliminate checkbox tests (see also #60742, #60747). Signed-off-by: Anna Larch <anna@nextcloud.com> AI-Assisted-By: Claude Sonnet 4.6 <noreply@anthropic.com>
provokateurin
approved these changes
May 27, 2026
8bc864e to
45d2121
Compare
Contributor
Author
|
/backport to stable34 |
45d2121 to
30abe60
Compare
susnux
previously requested changes
May 27, 2026
Contributor
susnux
left a comment
There was a problem hiding this comment.
your commit contains many unrelated translation files?
Replace assertTrue(true), addToAssertionCount(1) and delete-without-assert patterns with meaningful assertions or proper test removal. Signed-off-by: Anna Larch <anna@nextcloud.com> AI-Assisted-By: Claude Sonnet 4.6 <noreply@anthropic.com>
30abe60 to
18c5c07
Compare
artonge
approved these changes
May 27, 2026
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.
Summary
Seven test methods across five files used `assertTrue(true)` or `addToAssertionCount(1)` purely to silence PHPUnit's "no assertions" warning, providing no actual verification of behaviour.
Why
Tests that assert `assertTrue(true)` give a false sense of coverage. When a method's behaviour changes in a breaking way, these tests stay green and provide no signal. `#[DoesNotPerformAssertions]` is honest: it explicitly says "this test passes if it doesn't throw", which is at least a truthful contract.
Test plan
🤖 Generated with Claude Code