Skip to content

Commit 5392800

Browse files
committed
fixup! refactor(config): replace IConfig with IAppConfig for improved type safety and clarity
Signed-off-by: Christian Hartmann <chris-hartmann@gmx.de>
1 parent 95f1379 commit 5392800

3 files changed

Lines changed: 6 additions & 4 deletions

File tree

lib/Controller/ConfigController.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,13 +72,15 @@ public function updateAppConfig(string $configKey, mixed $configValue): DataResp
7272
} catch (\InvalidArgumentException $e) {
7373
return new DataResponse('Invalid value for ' . $configKey, Http::STATUS_BAD_REQUEST);
7474
}
75+
break;
7576

7677
case Constants::CONFIG_KEY_CREATIONALLOWEDGROUPS:
7778
try {
7879
$this->appConfig->setAppValueArray($configKey, $configValue);
7980
} catch (\InvalidArgumentException $e) {
8081
return new DataResponse('Invalid value for ' . $configKey, Http::STATUS_BAD_REQUEST);
8182
}
83+
break;
8284
}
8385

8486
return new DataResponse();

tests/Integration/IntegrationBase.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ class IntegrationBase extends TestCase {
3333
public function setUp(): void {
3434
parent::setUp();
3535

36-
$appConfig = \OCP\AppFramework\Services::get(IAppConfig::class);
36+
$appConfig = \OCP\Server::get(\OCP\AppFramework\Services\IAppConfig::class);
3737
foreach (Constants::CONFIG_KEYS as $key) {
3838
$appConfig->deleteAppValue($key);
3939
}

tests/Unit/Service/ConfigServiceTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -182,20 +182,20 @@ public static function dataCanCreateForms() {
182182
return [
183183
'notRestriced' => [
184184
'config' => [
185-
'restrictCreation' => 'false',
185+
'restrictCreation' => false,
186186
],
187187
'expected' => true
188188
],
189189
'restrictedGroupAllowed' => [
190190
'config' => [
191-
'restrictCreation' => 'true',
191+
'restrictCreation' => true,
192192
'creationAllowedGroups' => '["usersGroup","notUsersGroup"]'
193193
],
194194
'expected' => true
195195
],
196196
'restrictedNotInGroup' => [
197197
'config' => [
198-
'restrictCreation' => 'true',
198+
'restrictCreation' => true,
199199
'creationAllowedGroups' => '["notUsersGroup"]'
200200
],
201201
'expected' => false

0 commit comments

Comments
 (0)