From 2cc7f76d638be2f2786523c43f5ee13d3066a250 Mon Sep 17 00:00:00 2001 From: Anna Larch Date: Tue, 26 May 2026 23:18:46 +0200 Subject: [PATCH] test: replace checkbox assertions with DoesNotPerformAssertions (misc) Signed-off-by: Anna Larch AI-Assisted-By: Claude Sonnet 4.6 --- .../Listeners/RemoteWipeActivityListenerTest.php | 3 +-- .../Listeners/RemoteWipeNotificationsListenerTest.php | 3 +-- .../lib/Authentication/LoginCredentials/StoreTest.php | 2 +- tests/lib/Contacts/ContactsMenu/EntryTest.php | 2 +- tests/lib/Files/Cache/Wrapper/CacheJailTest.php | 2 +- tests/lib/Files/PathVerificationTest.php | 3 +-- tests/lib/Files/Storage/LocalTest.php | 2 +- tests/lib/Files/Storage/Wrapper/EncryptionTest.php | 4 ---- tests/lib/Group/Backend.php | 3 +-- .../IntegrityCheck/Helpers/FileAccessHelperTest.php | 2 +- .../Security/CSP/ContentSecurityPolicyManagerTest.php | 2 +- .../FeaturePolicy/FeaturePolicyManagerTest.php | 2 +- tests/lib/Support/CrashReport/RegistryTest.php | 10 ++-------- tests/lib/Support/Subscription/RegistryTest.php | 5 +---- tests/lib/Talk/ConversationOptionsTest.php | 3 +-- 15 files changed, 15 insertions(+), 33 deletions(-) diff --git a/tests/lib/Authentication/Listeners/RemoteWipeActivityListenerTest.php b/tests/lib/Authentication/Listeners/RemoteWipeActivityListenerTest.php index 288aa44883141..0c6de12589135 100644 --- a/tests/lib/Authentication/Listeners/RemoteWipeActivityListenerTest.php +++ b/tests/lib/Authentication/Listeners/RemoteWipeActivityListenerTest.php @@ -44,12 +44,11 @@ protected function setUp(): void { ); } + #[\PHPUnit\Framework\Attributes\DoesNotPerformAssertions] public function testHandleUnrelated(): void { $event = new Event(); $this->listener->handle($event); - - $this->addToAssertionCount(1); } public function testHandleRemoteWipeStarted(): void { diff --git a/tests/lib/Authentication/Listeners/RemoteWipeNotificationsListenerTest.php b/tests/lib/Authentication/Listeners/RemoteWipeNotificationsListenerTest.php index bb49fb9bbbd0b..611b76ba30cf6 100644 --- a/tests/lib/Authentication/Listeners/RemoteWipeNotificationsListenerTest.php +++ b/tests/lib/Authentication/Listeners/RemoteWipeNotificationsListenerTest.php @@ -45,12 +45,11 @@ protected function setUp(): void { ); } + #[\PHPUnit\Framework\Attributes\DoesNotPerformAssertions] public function testHandleUnrelated(): void { $event = new Event(); $this->listener->handle($event); - - $this->addToAssertionCount(1); } public function testHandleRemoteWipeStarted(): void { diff --git a/tests/lib/Authentication/LoginCredentials/StoreTest.php b/tests/lib/Authentication/LoginCredentials/StoreTest.php index f7c06f709a9d7..1a0a9f27278b9 100644 --- a/tests/lib/Authentication/LoginCredentials/StoreTest.php +++ b/tests/lib/Authentication/LoginCredentials/StoreTest.php @@ -65,11 +65,11 @@ public function testAuthenticate(): void { $this->store->authenticate($params); } + #[\PHPUnit\Framework\Attributes\DoesNotPerformAssertions] public function testSetSession(): void { $session = $this->createMock(ISession::class); $this->store->setSession($session); - $this->addToAssertionCount(1); } public function testGetLoginCredentialsNoTokenProvider(): void { diff --git a/tests/lib/Contacts/ContactsMenu/EntryTest.php b/tests/lib/Contacts/ContactsMenu/EntryTest.php index c0f07f7bf3b00..f63f2bf7048a9 100644 --- a/tests/lib/Contacts/ContactsMenu/EntryTest.php +++ b/tests/lib/Contacts/ContactsMenu/EntryTest.php @@ -21,9 +21,9 @@ protected function setUp(): void { $this->entry = new Entry(); } + #[\PHPUnit\Framework\Attributes\DoesNotPerformAssertions] public function testSetId(): void { $this->entry->setId(123); - $this->addToAssertionCount(1); } public function testSetGetFullName(): void { diff --git a/tests/lib/Files/Cache/Wrapper/CacheJailTest.php b/tests/lib/Files/Cache/Wrapper/CacheJailTest.php index 5ec3810497562..69c0d51a32d1b 100644 --- a/tests/lib/Files/Cache/Wrapper/CacheJailTest.php +++ b/tests/lib/Files/Cache/Wrapper/CacheJailTest.php @@ -140,9 +140,9 @@ public function testGetById(): void { } #[\Override] + #[\PHPUnit\Framework\Attributes\DoesNotPerformAssertions] public function testGetIncomplete(): void { //not supported - $this->addToAssertionCount(1); } public function testMoveFromJail(): void { diff --git a/tests/lib/Files/PathVerificationTest.php b/tests/lib/Files/PathVerificationTest.php index 4e318de209cac..9c6706c5a18dd 100644 --- a/tests/lib/Files/PathVerificationTest.php +++ b/tests/lib/Files/PathVerificationTest.php @@ -105,12 +105,11 @@ public static function providesAstralPlane(): array { } #[\PHPUnit\Framework\Attributes\DataProvider('providesValidPosixPaths')] + #[\PHPUnit\Framework\Attributes\DoesNotPerformAssertions] public function testPathVerificationValidPaths($fileName): void { $storage = new Local(['datadir' => '']); self::invokePrivate($storage, 'verifyPosixPath', [$fileName]); - // nothing thrown - $this->addToAssertionCount(1); } public static function providesValidPosixPaths(): array { diff --git a/tests/lib/Files/Storage/LocalTest.php b/tests/lib/Files/Storage/LocalTest.php index d55ac6a888b31..f49080ec39371 100644 --- a/tests/lib/Files/Storage/LocalTest.php +++ b/tests/lib/Files/Storage/LocalTest.php @@ -90,6 +90,7 @@ public function testDisallowSymlinksOutsideDatadir(): void { $storage->file_put_contents('sym/foo', 'bar'); } + #[\PHPUnit\Framework\Attributes\DoesNotPerformAssertions] public function testDisallowSymlinksInsideDatadir(): void { $subDir1 = $this->tmpDir . 'sub1'; $subDir2 = $this->tmpDir . 'sub1/sub2'; @@ -102,7 +103,6 @@ public function testDisallowSymlinksInsideDatadir(): void { $storage = new Local(['datadir' => $subDir1]); $storage->file_put_contents('sym/foo', 'bar'); - $this->addToAssertionCount(1); } public function testWriteUmaskFilePutContents(): void { diff --git a/tests/lib/Files/Storage/Wrapper/EncryptionTest.php b/tests/lib/Files/Storage/Wrapper/EncryptionTest.php index cfdf25a590c84..ea08b37a834d7 100644 --- a/tests/lib/Files/Storage/Wrapper/EncryptionTest.php +++ b/tests/lib/Files/Storage/Wrapper/EncryptionTest.php @@ -757,8 +757,6 @@ public function testCopyBetweenStorageMinimumEncryptedVersion(): void { ->with($sourceInternalPath, $expectedCachePut); $this->invokePrivate($this->instance, 'copyBetweenStorage', [$storage2, $sourceInternalPath, $targetInternalPath, $preserveMtime, $isRename]); - - $this->assertFalse(false); } /** @@ -817,8 +815,6 @@ public function testCopyBetweenStorage($encryptionEnabled, $mountPointEncryption ->with($sourceInternalPath, $expectedCachePut); $this->invokePrivate($this->instance, 'copyBetweenStorage', [$storage2, $sourceInternalPath, $targetInternalPath, $preserveMtime, $isRename]); - - $this->assertFalse(false); } /** diff --git a/tests/lib/Group/Backend.php b/tests/lib/Group/Backend.php index 23d877012cbd2..0fccb0f84fccd 100644 --- a/tests/lib/Group/Backend.php +++ b/tests/lib/Group/Backend.php @@ -133,12 +133,11 @@ public function testSearchUsers(): void { $this->assertSame(2, $result); } + #[\PHPUnit\Framework\Attributes\DoesNotPerformAssertions] public function testAddDouble(): void { $group = $this->getGroupName(); $this->backend->createGroup($group); $this->backend->createGroup($group); - - $this->addToAssertionCount(1); } } diff --git a/tests/lib/IntegrityCheck/Helpers/FileAccessHelperTest.php b/tests/lib/IntegrityCheck/Helpers/FileAccessHelperTest.php index 53bd83d0e509f..e5d78ee35ed00 100644 --- a/tests/lib/IntegrityCheck/Helpers/FileAccessHelperTest.php +++ b/tests/lib/IntegrityCheck/Helpers/FileAccessHelperTest.php @@ -53,8 +53,8 @@ public function testAssertDirectoryExistsWithException(): void { $this->fileAccessHelper->assertDirectoryExists('/anabsolutelynotexistingfolder/on/the/system'); } + #[\PHPUnit\Framework\Attributes\DoesNotPerformAssertions] public function testAssertDirectoryExists(): void { $this->fileAccessHelper->assertDirectoryExists(Server::get(ITempManager::class)->getTemporaryFolder('/testfolder/')); - $this->addToAssertionCount(1); } } diff --git a/tests/lib/Security/CSP/ContentSecurityPolicyManagerTest.php b/tests/lib/Security/CSP/ContentSecurityPolicyManagerTest.php index a7e2fda91ec01..9bd089d4840a1 100644 --- a/tests/lib/Security/CSP/ContentSecurityPolicyManagerTest.php +++ b/tests/lib/Security/CSP/ContentSecurityPolicyManagerTest.php @@ -32,9 +32,9 @@ protected function setUp(): void { $this->contentSecurityPolicyManager = new ContentSecurityPolicyManager($this->dispatcher); } + #[\PHPUnit\Framework\Attributes\DoesNotPerformAssertions] public function testAddDefaultPolicy(): void { $this->contentSecurityPolicyManager->addDefaultPolicy(new ContentSecurityPolicy()); - $this->addToAssertionCount(1); } public function testGetDefaultPolicyWithPolicies(): void { diff --git a/tests/lib/Security/FeaturePolicy/FeaturePolicyManagerTest.php b/tests/lib/Security/FeaturePolicy/FeaturePolicyManagerTest.php index c20c2a8d072b6..00aef2a2873d7 100644 --- a/tests/lib/Security/FeaturePolicy/FeaturePolicyManagerTest.php +++ b/tests/lib/Security/FeaturePolicy/FeaturePolicyManagerTest.php @@ -29,9 +29,9 @@ protected function setUp(): void { $this->manager = new FeaturePolicyManager($this->dispatcher); } + #[\PHPUnit\Framework\Attributes\DoesNotPerformAssertions] public function testAddDefaultPolicy(): void { $this->manager->addDefaultPolicy(new FeaturePolicy()); - $this->addToAssertionCount(1); } public function testGetDefaultPolicyWithPoliciesViaEvent(): void { diff --git a/tests/lib/Support/CrashReport/RegistryTest.php b/tests/lib/Support/CrashReport/RegistryTest.php index 2355d6c732252..8756eff0efb3d 100644 --- a/tests/lib/Support/CrashReport/RegistryTest.php +++ b/tests/lib/Support/CrashReport/RegistryTest.php @@ -27,14 +27,11 @@ protected function setUp(): void { $this->registry = new Registry(); } - /** - * Doesn't assert anything, just checks whether anything "explodes" - */ + #[\PHPUnit\Framework\Attributes\DoesNotPerformAssertions] public function testDelegateToNone(): void { $exception = new Exception('test'); $this->registry->delegateReport($exception); - $this->addToAssertionCount(1); } public function testRegisterLazy(): void { @@ -49,9 +46,7 @@ public function testRegisterLazy(): void { $this->registry->delegateReport($exception); } - /** - * Doesn't assert anything, just checks whether anything "explodes" - */ + #[\PHPUnit\Framework\Attributes\DoesNotPerformAssertions] public function testRegisterLazyCantLoad(): void { $reporterClass = '\OCA\MyApp\Reporter'; /* We do not register reporterClass in DI, so it will throw a QueryException queried */ @@ -59,7 +54,6 @@ public function testRegisterLazyCantLoad(): void { $this->registry->registerLazy($reporterClass); $this->registry->delegateReport($exception); - $this->addToAssertionCount(1); } public function testDelegateBreadcrumbCollection(): void { diff --git a/tests/lib/Support/Subscription/RegistryTest.php b/tests/lib/Support/Subscription/RegistryTest.php index 0be3d3501427d..1f82c3a301e49 100644 --- a/tests/lib/Support/Subscription/RegistryTest.php +++ b/tests/lib/Support/Subscription/RegistryTest.php @@ -49,12 +49,9 @@ protected function setUp(): void { ); } - /** - * Doesn't assert anything, just checks whether anything "explodes" - */ + #[\PHPUnit\Framework\Attributes\DoesNotPerformAssertions] public function testDelegateToNone(): void { $this->registry->delegateHasValidSubscription(); - $this->addToAssertionCount(1); } diff --git a/tests/lib/Talk/ConversationOptionsTest.php b/tests/lib/Talk/ConversationOptionsTest.php index ca6befbd7c95d..0817033b3fba9 100644 --- a/tests/lib/Talk/ConversationOptionsTest.php +++ b/tests/lib/Talk/ConversationOptionsTest.php @@ -13,9 +13,8 @@ use Test\TestCase; class ConversationOptionsTest extends TestCase { + #[\PHPUnit\Framework\Attributes\DoesNotPerformAssertions] public function testDefaults(): void { ConversationOptions::default(); - - $this->addToAssertionCount(1); } }