Merge pull request #60748 from nextcloud/fix/noid/checkbox-tests-middleware

test: replace checkbox assertions with DoesNotPerformAssertions (middleware)
This commit is contained in:
Anna 2026-05-27 10:56:11 +02:00 committed by GitHub
commit 2622eee5ae
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
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')]