test: remove no-op checkbox assertions

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>
This commit is contained in:
Anna Larch 2026-05-27 12:12:44 +02:00
parent f1915e0dd4
commit 18c5c0711e
5 changed files with 11 additions and 25 deletions

View file

@ -53,11 +53,11 @@ class PublicShareMiddlewareTest extends \Test\TestCase {
);
}
#[\PHPUnit\Framework\Attributes\DoesNotPerformAssertions]
public function testBeforeControllerNoPublicShareController(): void {
$controller = $this->createMock(Controller::class);
$this->middleware->beforeController($controller, 'method');
$this->assertTrue(true);
}
public static function dataShareApi(): array {
@ -157,14 +157,11 @@ class PublicShareMiddlewareTest extends \Test\TestCase {
->with('token', null)
->willReturn('myToken');
$controller->method('isValidToken')
->willReturn(true);
$controller->method('isPasswordProtected')
$controller->expects($this->once())
->method('isValidToken')
->willReturn(true);
$this->middleware->beforeController($controller, 'authenticate');
$this->assertTrue(true);
}
public function testBeforeControllerValidTokenShowAuthenticateMethod(): void {
@ -182,14 +179,11 @@ class PublicShareMiddlewareTest extends \Test\TestCase {
->with('token', null)
->willReturn('myToken');
$controller->method('isValidToken')
->willReturn(true);
$controller->method('isPasswordProtected')
$controller->expects($this->once())
->method('isValidToken')
->willReturn(true);
$this->middleware->beforeController($controller, 'showAuthenticate');
$this->assertTrue(true);
}
public function testBeforeControllerAuthPublicShareController(): void {

View file

@ -65,6 +65,7 @@ class SharedQueryBuilderTest extends TestCase {
$this->assertEquals([], $query->getShardKeys());
}
#[\PHPUnit\Framework\Attributes\DoesNotPerformAssertions]
public function testValidateWithShardKey(): void {
$query = $this->getQueryBuilder('filecache', 'storage', 'fileid');
$query->select('fileid', 'path')
@ -72,9 +73,9 @@ class SharedQueryBuilderTest extends TestCase {
->where($query->expr()->eq('storage', $query->createNamedParameter(10)));
$query->validate();
$this->assertTrue(true);
}
#[\PHPUnit\Framework\Attributes\DoesNotPerformAssertions]
public function testValidateWithPrimaryKey(): void {
$query = $this->getQueryBuilder('filecache', 'storage', 'fileid');
$query->select('fileid', 'path')
@ -82,7 +83,6 @@ class SharedQueryBuilderTest extends TestCase {
->where($query->expr()->in('fileid', $query->createNamedParameter([10, 11], IQueryBuilder::PARAM_INT)));
$query->validate();
$this->assertTrue(true);
}
public function testValidateWithNoKey(): void {
@ -96,6 +96,7 @@ class SharedQueryBuilderTest extends TestCase {
$this->fail('exception expected');
}
#[\PHPUnit\Framework\Attributes\DoesNotPerformAssertions]
public function testValidateNonSharedTable(): void {
$query = $this->getQueryBuilder('filecache', 'storage', 'fileid');
$query->select('configvalue')
@ -103,7 +104,6 @@ class SharedQueryBuilderTest extends TestCase {
->where($query->expr()->eq('configkey', $query->createNamedParameter('test')));
$query->validate();
$this->assertTrue(true);
}
public function testGetShardKeyMultipleSingleParam(): void {

View file

@ -45,15 +45,9 @@ class InMemoryFileTest extends TestCase {
self::assertEquals('test', $this->testPdf->getContent());
}
/**
* Asserts that delete() doesn't rise an exception.
*
* @return void
*/
#[\PHPUnit\Framework\Attributes\DoesNotPerformAssertions]
public function testDelete(): void {
$this->testPdf->delete();
// assert true, otherwise phpunit complains about not doing any assert
self::assertTrue(true);
}
/**

View file

@ -48,6 +48,5 @@ class ClearFrontendCachesTest extends \Test\TestCase {
->willReturn($imagePathCache);
$this->repair->run($this->outputMock);
$this->assertTrue(true);
}
}

View file

@ -103,10 +103,9 @@ class BrokerTest extends TestCase {
}
public function testNewConversationOptions(): void {
$this->broker->newConversationOptions();
$options = $this->broker->newConversationOptions();
// Nothing to assert
$this->addToAssertionCount(1);
$this->assertInstanceOf(IConversationOptions::class, $options);
}
public function testCreateConversation(): void {