Skip to content

Commit 620424d

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 620424d

3 files changed

Lines changed: 6 additions & 5 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 & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
namespace OCA\Forms\Tests\Integration;
99

1010
use OCA\Forms\Constants;
11-
use OCP\AppFramework\Services\IAppConfig;
1211
use OCP\DB\QueryBuilder\IQueryBuilder;
1312
use OCP\IDBConnection;
1413
use OCP\IUserManager;
@@ -33,7 +32,7 @@ class IntegrationBase extends TestCase {
3332
public function setUp(): void {
3433
parent::setUp();
3534

36-
$appConfig = \OCP\AppFramework\Services::get(IAppConfig::class);
35+
$appConfig = \OCP\Server::get(\OCP\AppFramework\Services\IAppConfig::class);
3736
foreach (Constants::CONFIG_KEYS as $key) {
3837
$appConfig->deleteAppValue($key);
3938
}

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)