test: replace checkbox assertions with real assertions or DoesNotPerformAssertions#60742
Open
miaulalala wants to merge 2 commits into
Open
test: replace checkbox assertions with real assertions or DoesNotPerformAssertions#60742miaulalala wants to merge 2 commits into
miaulalala wants to merge 2 commits into
Conversation
added 2 commits
May 26, 2026 18:33
…ormAssertions Seven test methods across five files used `assertTrue(true)` or `addToAssertionCount(1)` purely to silence PHPUnit's "no assertions" warning, providing no actual verification. - ClearFrontendCachesTest::testRun — already had mock expectations; drop the surplus assertTrue(true) - BrokerTest::testNewConversationOptions — assert return type is IConversationOptions instead of addToAssertionCount(1) - SharedQueryBuilderTest (×3 validate tests) — tests verify no exception is thrown for valid queries; use DoesNotPerformAssertions attribute - PublicShareMiddlewareTest (×3 no-op path tests) — same pattern; use DoesNotPerformAssertions attribute - InMemoryFileTest::testDelete — delete() is a documented no-op; use DoesNotPerformAssertions attribute AI-Assisted-By: Claude Sonnet 4.6 <noreply@anthropic.com> Signed-off-by: Anna Larch <anna@nextcloud.com>
…NotPerformAssertions AI-Assisted-By: Claude Sonnet 4.6 <noreply@anthropic.com> Signed-off-by: Anna Larch <anna@nextcloud.com>
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>
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