diff options
author | Carl Schwan <carl@carlschwan.eu> | 2021-10-15 21:59:43 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-10-15 21:59:43 +0300 |
commit | a67a12cb96250144c47ffb99ac1efa8a8c51a6b3 (patch) | |
tree | 70f6805d16880edcdcff4ae332e8c3e571db6446 /apps/provisioning_api/tests/Middleware/ProvisioningApiMiddlewareTest.php | |
parent | ff67ada049fdb26f881450f7899f8eccfcd33310 (diff) | |
parent | 719dbafd1339702a170f04ebbc4f20e80d45e8c9 (diff) |
Merge pull request #29240 from nextcloud/work/admin-delegation-implementation
Add support for Delegation Settings for more apps
Diffstat (limited to 'apps/provisioning_api/tests/Middleware/ProvisioningApiMiddlewareTest.php')
-rw-r--r-- | apps/provisioning_api/tests/Middleware/ProvisioningApiMiddlewareTest.php | 34 |
1 files changed, 24 insertions, 10 deletions
diff --git a/apps/provisioning_api/tests/Middleware/ProvisioningApiMiddlewareTest.php b/apps/provisioning_api/tests/Middleware/ProvisioningApiMiddlewareTest.php index ea3d44cc907..37ab03f758c 100644 --- a/apps/provisioning_api/tests/Middleware/ProvisioningApiMiddlewareTest.php +++ b/apps/provisioning_api/tests/Middleware/ProvisioningApiMiddlewareTest.php @@ -45,13 +45,20 @@ class ProvisioningApiMiddlewareTest extends TestCase { public function dataAnnotation() { return [ - [false, false, false, false], - [false, false, true, false], - [false, true, true, false], - [ true, false, false, true], - [ true, false, true, false], - [ true, true, false, false], - [ true, true, true, false], + [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, 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], ]; } @@ -63,7 +70,7 @@ class ProvisioningApiMiddlewareTest extends TestCase { * @param bool $isSubAdmin * @param bool $shouldThrowException */ - public function testBeforeController($subadminRequired, $isAdmin, $isSubAdmin, $shouldThrowException) { + public function testBeforeController($subadminRequired, $isAdmin, $isSubAdmin, $hasSettingAuthorizationAnnotation, $shouldThrowException) { $middleware = new ProvisioningApiMiddleware( $this->reflector, $isAdmin, @@ -71,8 +78,15 @@ class ProvisioningApiMiddlewareTest extends TestCase { ); $this->reflector->method('hasAnnotation') - ->with('NoSubAdminRequired') - ->willReturn(!$subadminRequired); + ->willReturnCallback(function ($annotation) use ($subadminRequired, $hasSettingAuthorizationAnnotation) { + if ($annotation === 'NoSubAdminRequired') { + return !$subadminRequired; + } + if ($annotation === 'AuthorizedAdminSetting') { + return $hasSettingAuthorizationAnnotation; + } + return false; + }); try { $middleware->beforeController( |