From d30f3c491d98a72437fbf73b432233982107a093 Mon Sep 17 00:00:00 2001 From: Anna Larch Date: Tue, 26 May 2026 23:18:55 +0200 Subject: [PATCH] test: replace checkbox assertions with DoesNotPerformAssertions (middleware) Signed-off-by: Anna Larch AI-Assisted-By: Claude Sonnet 4.6 --- .../Middleware/Security/SameSiteCookieMiddlewareTest.php | 4 +--- .../Middleware/Security/SecurityMiddlewareTest.php | 6 ++---- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/tests/lib/AppFramework/Middleware/Security/SameSiteCookieMiddlewareTest.php b/tests/lib/AppFramework/Middleware/Security/SameSiteCookieMiddlewareTest.php index b7766f80784..f7ec3a94a6e 100644 --- a/tests/lib/AppFramework/Middleware/Security/SameSiteCookieMiddlewareTest.php +++ b/tests/lib/AppFramework/Middleware/Security/SameSiteCookieMiddlewareTest.php @@ -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 { diff --git a/tests/lib/AppFramework/Middleware/Security/SecurityMiddlewareTest.php b/tests/lib/AppFramework/Middleware/Security/SecurityMiddlewareTest.php index 9ff6627eeef..f59d5d4c004 100644 --- a/tests/lib/AppFramework/Middleware/Security/SecurityMiddlewareTest.php +++ b/tests/lib/AppFramework/Middleware/Security/SecurityMiddlewareTest.php @@ -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')]