Skip to content

Commit 1bec2b5

Browse files
committed
fix(tests): replace checkbox assertions with DoesNotPerformAssertions
Replace `addToAssertionCount(1)` and `assertFalse(false)` placeholders with `#[DoesNotPerformAssertions]` in tests that only verify no exception is thrown. For EncryptionTest, the placeholder is redundant because the existing `expects($this->once())` mock expectations already serve as the meaningful assertions. Signed-off-by: Anna Larch <anna@nextcloud.com> AI-Assisted-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 492a42b commit 1bec2b5

15 files changed

Lines changed: 15 additions & 33 deletions

File tree

tests/lib/Authentication/Listeners/RemoteWipeActivityListenerTest.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,12 +44,11 @@ protected function setUp(): void {
4444
);
4545
}
4646

47+
#[\PHPUnit\Framework\Attributes\DoesNotPerformAssertions]
4748
public function testHandleUnrelated(): void {
4849
$event = new Event();
4950

5051
$this->listener->handle($event);
51-
52-
$this->addToAssertionCount(1);
5352
}
5453

5554
public function testHandleRemoteWipeStarted(): void {

tests/lib/Authentication/Listeners/RemoteWipeNotificationsListenerTest.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,11 @@ protected function setUp(): void {
4545
);
4646
}
4747

48+
#[\PHPUnit\Framework\Attributes\DoesNotPerformAssertions]
4849
public function testHandleUnrelated(): void {
4950
$event = new Event();
5051

5152
$this->listener->handle($event);
52-
53-
$this->addToAssertionCount(1);
5453
}
5554

5655
public function testHandleRemoteWipeStarted(): void {

tests/lib/Authentication/LoginCredentials/StoreTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,11 +65,11 @@ public function testAuthenticate(): void {
6565
$this->store->authenticate($params);
6666
}
6767

68+
#[\PHPUnit\Framework\Attributes\DoesNotPerformAssertions]
6869
public function testSetSession(): void {
6970
$session = $this->createMock(ISession::class);
7071

7172
$this->store->setSession($session);
72-
$this->addToAssertionCount(1);
7373
}
7474

7575
public function testGetLoginCredentialsNoTokenProvider(): void {

tests/lib/Contacts/ContactsMenu/EntryTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ protected function setUp(): void {
2121
$this->entry = new Entry();
2222
}
2323

24+
#[\PHPUnit\Framework\Attributes\DoesNotPerformAssertions]
2425
public function testSetId(): void {
2526
$this->entry->setId(123);
26-
$this->addToAssertionCount(1);
2727
}
2828

2929
public function testSetGetFullName(): void {

tests/lib/Files/Cache/Wrapper/CacheJailTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,9 +140,9 @@ public function testGetById(): void {
140140
}
141141

142142
#[\Override]
143+
#[\PHPUnit\Framework\Attributes\DoesNotPerformAssertions]
143144
public function testGetIncomplete(): void {
144145
//not supported
145-
$this->addToAssertionCount(1);
146146
}
147147

148148
public function testMoveFromJail(): void {

tests/lib/Files/PathVerificationTest.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,12 +105,11 @@ public static function providesAstralPlane(): array {
105105
}
106106

107107
#[\PHPUnit\Framework\Attributes\DataProvider('providesValidPosixPaths')]
108+
#[\PHPUnit\Framework\Attributes\DoesNotPerformAssertions]
108109
public function testPathVerificationValidPaths($fileName): void {
109110
$storage = new Local(['datadir' => '']);
110111

111112
self::invokePrivate($storage, 'verifyPosixPath', [$fileName]);
112-
// nothing thrown
113-
$this->addToAssertionCount(1);
114113
}
115114

116115
public static function providesValidPosixPaths(): array {

tests/lib/Files/Storage/LocalTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ public function testDisallowSymlinksOutsideDatadir(): void {
9090
$storage->file_put_contents('sym/foo', 'bar');
9191
}
9292

93+
#[\PHPUnit\Framework\Attributes\DoesNotPerformAssertions]
9394
public function testDisallowSymlinksInsideDatadir(): void {
9495
$subDir1 = $this->tmpDir . 'sub1';
9596
$subDir2 = $this->tmpDir . 'sub1/sub2';
@@ -102,7 +103,6 @@ public function testDisallowSymlinksInsideDatadir(): void {
102103
$storage = new Local(['datadir' => $subDir1]);
103104

104105
$storage->file_put_contents('sym/foo', 'bar');
105-
$this->addToAssertionCount(1);
106106
}
107107

108108
public function testWriteUmaskFilePutContents(): void {

tests/lib/Files/Storage/Wrapper/EncryptionTest.php

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -757,8 +757,6 @@ public function testCopyBetweenStorageMinimumEncryptedVersion(): void {
757757
->with($sourceInternalPath, $expectedCachePut);
758758

759759
$this->invokePrivate($this->instance, 'copyBetweenStorage', [$storage2, $sourceInternalPath, $targetInternalPath, $preserveMtime, $isRename]);
760-
761-
$this->assertFalse(false);
762760
}
763761

764762
/**
@@ -817,8 +815,6 @@ public function testCopyBetweenStorage($encryptionEnabled, $mountPointEncryption
817815
->with($sourceInternalPath, $expectedCachePut);
818816

819817
$this->invokePrivate($this->instance, 'copyBetweenStorage', [$storage2, $sourceInternalPath, $targetInternalPath, $preserveMtime, $isRename]);
820-
821-
$this->assertFalse(false);
822818
}
823819

824820
/**

tests/lib/Group/Backend.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,12 +133,11 @@ public function testSearchUsers(): void {
133133
$this->assertSame(2, $result);
134134
}
135135

136+
#[\PHPUnit\Framework\Attributes\DoesNotPerformAssertions]
136137
public function testAddDouble(): void {
137138
$group = $this->getGroupName();
138139

139140
$this->backend->createGroup($group);
140141
$this->backend->createGroup($group);
141-
142-
$this->addToAssertionCount(1);
143142
}
144143
}

tests/lib/IntegrityCheck/Helpers/FileAccessHelperTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,8 @@ public function testAssertDirectoryExistsWithException(): void {
5353
$this->fileAccessHelper->assertDirectoryExists('/anabsolutelynotexistingfolder/on/the/system');
5454
}
5555

56+
#[\PHPUnit\Framework\Attributes\DoesNotPerformAssertions]
5657
public function testAssertDirectoryExists(): void {
5758
$this->fileAccessHelper->assertDirectoryExists(Server::get(ITempManager::class)->getTemporaryFolder('/testfolder/'));
58-
$this->addToAssertionCount(1);
5959
}
6060
}

0 commit comments

Comments
 (0)