test: replace checkbox assertions with DoesNotPerformAssertions (middleware)

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-26 23:18:55 +02:00
parent 492a42b4b3
commit d30f3c491d
2 changed files with 3 additions and 7 deletions

View file

@ -50,12 +50,12 @@ class SameSiteCookieMiddlewareTest extends TestCase {
$this->middleware = new SameSiteCookieMiddleware($this->request, new MiddlewareUtils($this->reflector, $this->logger));
}
#[\PHPUnit\Framework\Attributes\DoesNotPerformAssertions]
public function testBeforeControllerNoIndex(): void {
$this->request->method('getScriptName')
->willReturn('/ocs/v2.php');
$this->middleware->beforeController(new NoAnnotationController('foo', $this->request), 'foo');
$this->addToAssertionCount(1);
}
public function testBeforeControllerIndexHasAnnotation(): void {
@ -68,7 +68,6 @@ class SameSiteCookieMiddlewareTest extends TestCase {
->willReturn(true);
$this->middleware->beforeController(new HasAnnotationController('foo', $this->request), 'foo');
$this->addToAssertionCount(1);
}
public function testBeforeControllerIndexNoAnnotationPassingCheck(): void {
@ -84,7 +83,6 @@ class SameSiteCookieMiddlewareTest extends TestCase {
->willReturn(true);
$this->middleware->beforeController(new NoAnnotationController('foo', $this->request), 'foo');
$this->addToAssertionCount(1);
}
public function testBeforeControllerIndexNoAnnotationFailingCheck(): void {

View file

@ -470,21 +470,21 @@ class SecurityMiddlewareTest extends \Test\TestCase {
}
#[\PHPUnit\Framework\Attributes\DataProvider('dataNoCSRFRequiredSubAdminRequired')]
#[\PHPUnit\Framework\Attributes\DoesNotPerformAssertions]
public function testIsSubAdminCheck(string $method): void {
$this->reader->reflect($this->controller, $method);
$sec = $this->getMiddleware(true, false, true);
$sec->beforeController($this->controller, $method);
$this->addToAssertionCount(1);
}
#[\PHPUnit\Framework\Attributes\DataProvider('dataNoCSRFRequiredSubAdminRequired')]
#[\PHPUnit\Framework\Attributes\DoesNotPerformAssertions]
public function testIsSubAdminAndAdminCheck(string $method): void {
$this->reader->reflect($this->controller, $method);
$sec = $this->getMiddleware(true, true, true);
$sec->beforeController($this->controller, $method);
$this->addToAssertionCount(1);
}
#[\PHPUnit\Framework\Attributes\DataProvider('dataNoCSRFRequired')]
@ -506,7 +506,6 @@ class SecurityMiddlewareTest extends \Test\TestCase {
->willReturn(false);
$middleware->beforeController($this->controller, $method);
$this->addToAssertionCount(1);
}
#[\PHPUnit\Framework\Attributes\DataProvider('dataNoAdminRequiredNoCSRFRequiredPublicPage')]
@ -523,7 +522,6 @@ class SecurityMiddlewareTest extends \Test\TestCase {
->willReturn(false);
$middleware->beforeController($this->controller, $method);
$this->addToAssertionCount(1);
}
#[\PHPUnit\Framework\Attributes\DataProvider('dataNoAdminRequiredNoCSRFRequired')]