aboutsummaryrefslogtreecommitdiffstats
path: root/apps/provisioning_api/tests/Middleware/ProvisioningApiMiddlewareTest.php
diff options
context:
space:
mode:
Diffstat (limited to 'apps/provisioning_api/tests/Middleware/ProvisioningApiMiddlewareTest.php')
-rw-r--r--apps/provisioning_api/tests/Middleware/ProvisioningApiMiddlewareTest.php49
1 files changed, 19 insertions, 30 deletions
diff --git a/apps/provisioning_api/tests/Middleware/ProvisioningApiMiddlewareTest.php b/apps/provisioning_api/tests/Middleware/ProvisioningApiMiddlewareTest.php
index d097febb04f..c027e518a3d 100644
--- a/apps/provisioning_api/tests/Middleware/ProvisioningApiMiddlewareTest.php
+++ b/apps/provisioning_api/tests/Middleware/ProvisioningApiMiddlewareTest.php
@@ -1,4 +1,5 @@
<?php
+
/**
* SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
@@ -24,34 +25,27 @@ class ProvisioningApiMiddlewareTest extends TestCase {
$this->reflector = $this->createMock(IControllerMethodReflector::class);
}
- public function dataAnnotation() {
+ public static function dataAnnotation(): array {
return [
[false, false, false, false, false],
- [false, false, true, false, false],
- [false, true, true, false, false],
- [ true, false, false, false, true],
- [ true, false, true, false, false],
- [ true, true, false, false, false],
- [ true, true, true, false, false],
+ [false, false, true, false, false],
+ [false, true, true, false, false],
+ [true, false, false, false, true],
+ [true, false, true, false, false],
+ [true, true, false, false, false],
+ [true, true, true, false, false],
[false, false, false, true, false],
- [false, false, true, true, false],
- [false, true, true, true, false],
- [ true, false, false, true, false],
- [ true, false, true, true, false],
- [ true, true, false, true, false],
- [ true, true, true, true, false],
+ [false, false, true, true, false],
+ [false, true, true, true, false],
+ [true, false, false, true, false],
+ [true, false, true, true, false],
+ [true, true, false, true, false],
+ [true, true, true, true, false],
];
}
- /**
- * @dataProvider dataAnnotation
- *
- * @param bool $subadminRequired
- * @param bool $isAdmin
- * @param bool $isSubAdmin
- * @param bool $shouldThrowException
- */
- public function testBeforeController($subadminRequired, $isAdmin, $isSubAdmin, $hasSettingAuthorizationAnnotation, $shouldThrowException): void {
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataAnnotation')]
+ public function testBeforeController(bool $subadminRequired, bool $isAdmin, bool $isSubAdmin, bool $hasSettingAuthorizationAnnotation, bool $shouldThrowException): void {
$middleware = new ProvisioningApiMiddleware(
$this->reflector,
$isAdmin,
@@ -80,20 +74,15 @@ class ProvisioningApiMiddlewareTest extends TestCase {
}
}
- public function dataAfterException() {
+ public static function dataAfterException(): array {
return [
[new NotSubAdminException(), false],
[new \Exception('test', 42), true],
];
}
- /**
- * @dataProvider dataAfterException
- *
- * @param \Exception $e
- * @param bool $forwared
- */
- public function testAfterException(\Exception $exception, $forwared): void {
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataAfterException')]
+ public function testAfterException(\Exception $exception, bool $forwared): void {
$middleware = new ProvisioningApiMiddleware(
$this->reflector,
false,