diff options
Diffstat (limited to 'tests/lib')
-rw-r--r-- | tests/lib/Config/LexiconTest.php | 94 | ||||
-rw-r--r-- | tests/lib/Config/TestConfigLexicon_E.php | 49 | ||||
-rw-r--r-- | tests/lib/Config/TestConfigLexicon_I.php | 28 | ||||
-rw-r--r-- | tests/lib/Config/TestConfigLexicon_N.php | 39 | ||||
-rw-r--r-- | tests/lib/Config/TestConfigLexicon_W.php | 39 | ||||
-rw-r--r-- | tests/lib/Config/TestLexicon_E.php | 49 | ||||
-rw-r--r-- | tests/lib/Config/TestLexicon_N.php | 39 | ||||
-rw-r--r-- | tests/lib/Config/TestLexicon_W.php | 39 | ||||
-rw-r--r-- | tests/lib/Config/UserConfigTest.php | 8 |
9 files changed, 192 insertions, 192 deletions
diff --git a/tests/lib/Config/LexiconTest.php b/tests/lib/Config/LexiconTest.php index 760ac08a147..def9e152853 100644 --- a/tests/lib/Config/LexiconTest.php +++ b/tests/lib/Config/LexiconTest.php @@ -7,13 +7,13 @@ declare(strict_types=1); */ namespace Tests\lib\Config; -use NCU\Config\Exceptions\TypeConflictException; -use NCU\Config\Exceptions\UnknownKeyException; -use NCU\Config\IUserConfig; -use NCU\Config\Lexicon\Preset; use OC\AppConfig; use OC\AppFramework\Bootstrap\Coordinator; use OC\Config\ConfigManager; +use OCP\Config\Exceptions\TypeConflictException; +use OCP\Config\Exceptions\UnknownKeyException; +use OCP\Config\IUserConfig; +use OCP\Config\Lexicon\Preset; use OCP\Exceptions\AppConfigTypeConflictException; use OCP\Exceptions\AppConfigUnknownKeyException; use OCP\IAppConfig; @@ -38,9 +38,9 @@ class LexiconTest extends TestCase { $bootstrapCoordinator = Server::get(Coordinator::class); $bootstrapCoordinator->getRegistrationContext()?->registerConfigLexicon(TestConfigLexicon_I::APPID, TestConfigLexicon_I::class); - $bootstrapCoordinator->getRegistrationContext()?->registerConfigLexicon(TestConfigLexicon_N::APPID, TestConfigLexicon_N::class); - $bootstrapCoordinator->getRegistrationContext()?->registerConfigLexicon(TestConfigLexicon_W::APPID, TestConfigLexicon_W::class); - $bootstrapCoordinator->getRegistrationContext()?->registerConfigLexicon(TestConfigLexicon_E::APPID, TestConfigLexicon_E::class); + $bootstrapCoordinator->getRegistrationContext()?->registerConfigLexicon(TestLexicon_N::APPID, TestLexicon_N::class); + $bootstrapCoordinator->getRegistrationContext()?->registerConfigLexicon(TestLexicon_W::APPID, TestLexicon_W::class); + $bootstrapCoordinator->getRegistrationContext()?->registerConfigLexicon(TestLexicon_E::APPID, TestLexicon_E::class); $this->appConfig = Server::get(IAppConfig::class); $this->userConfig = Server::get(IUserConfig::class); @@ -51,35 +51,35 @@ class LexiconTest extends TestCase { parent::tearDown(); $this->appConfig->deleteApp(TestConfigLexicon_I::APPID); - $this->appConfig->deleteApp(TestConfigLexicon_N::APPID); - $this->appConfig->deleteApp(TestConfigLexicon_W::APPID); - $this->appConfig->deleteApp(TestConfigLexicon_E::APPID); + $this->appConfig->deleteApp(TestLexicon_N::APPID); + $this->appConfig->deleteApp(TestLexicon_W::APPID); + $this->appConfig->deleteApp(TestLexicon_E::APPID); $this->userConfig->deleteApp(TestConfigLexicon_I::APPID); - $this->userConfig->deleteApp(TestConfigLexicon_N::APPID); - $this->userConfig->deleteApp(TestConfigLexicon_W::APPID); - $this->userConfig->deleteApp(TestConfigLexicon_E::APPID); + $this->userConfig->deleteApp(TestLexicon_N::APPID); + $this->userConfig->deleteApp(TestLexicon_W::APPID); + $this->userConfig->deleteApp(TestLexicon_E::APPID); } public function testAppLexiconSetCorrect() { - $this->assertSame(true, $this->appConfig->setValueString(TestConfigLexicon_E::APPID, 'key1', 'new_value')); - $this->assertSame(true, $this->appConfig->isLazy(TestConfigLexicon_E::APPID, 'key1')); - $this->assertSame(true, $this->appConfig->isSensitive(TestConfigLexicon_E::APPID, 'key1')); - $this->appConfig->deleteKey(TestConfigLexicon_E::APPID, 'key1'); + $this->assertSame(true, $this->appConfig->setValueString(TestLexicon_E::APPID, 'key1', 'new_value')); + $this->assertSame(true, $this->appConfig->isLazy(TestLexicon_E::APPID, 'key1')); + $this->assertSame(true, $this->appConfig->isSensitive(TestLexicon_E::APPID, 'key1')); + $this->appConfig->deleteKey(TestLexicon_E::APPID, 'key1'); } public function testAppLexiconGetCorrect() { - $this->assertSame('abcde', $this->appConfig->getValueString(TestConfigLexicon_E::APPID, 'key1', 'default')); + $this->assertSame('abcde', $this->appConfig->getValueString(TestLexicon_E::APPID, 'key1', 'default')); } public function testAppLexiconSetIncorrectValueType() { $this->expectException(AppConfigTypeConflictException::class); - $this->appConfig->setValueInt(TestConfigLexicon_E::APPID, 'key1', -1); + $this->appConfig->setValueInt(TestLexicon_E::APPID, 'key1', -1); } public function testAppLexiconGetIncorrectValueType() { $this->expectException(AppConfigTypeConflictException::class); - $this->appConfig->getValueInt(TestConfigLexicon_E::APPID, 'key1'); + $this->appConfig->getValueInt(TestLexicon_E::APPID, 'key1'); } public function testAppLexiconIgnore() { @@ -88,45 +88,45 @@ class LexiconTest extends TestCase { } public function testAppLexiconNotice() { - $this->appConfig->setValueString(TestConfigLexicon_N::APPID, 'key_notice', 'new_value'); - $this->assertSame('new_value', $this->appConfig->getValueString(TestConfigLexicon_N::APPID, 'key_notice', '')); + $this->appConfig->setValueString(TestLexicon_N::APPID, 'key_notice', 'new_value'); + $this->assertSame('new_value', $this->appConfig->getValueString(TestLexicon_N::APPID, 'key_notice', '')); } public function testAppLexiconWarning() { - $this->appConfig->setValueString(TestConfigLexicon_W::APPID, 'key_warning', 'new_value'); - $this->assertSame('', $this->appConfig->getValueString(TestConfigLexicon_W::APPID, 'key_warning', '')); + $this->appConfig->setValueString(TestLexicon_W::APPID, 'key_warning', 'new_value'); + $this->assertSame('', $this->appConfig->getValueString(TestLexicon_W::APPID, 'key_warning', '')); } public function testAppLexiconSetException() { $this->expectException(AppConfigUnknownKeyException::class); - $this->appConfig->setValueString(TestConfigLexicon_E::APPID, 'key_exception', 'new_value'); - $this->assertSame('', $this->appConfig->getValueString(TestConfigLexicon_E::APPID, 'key3', '')); + $this->appConfig->setValueString(TestLexicon_E::APPID, 'key_exception', 'new_value'); + $this->assertSame('', $this->appConfig->getValueString(TestLexicon_E::APPID, 'key3', '')); } public function testAppLexiconGetException() { $this->expectException(AppConfigUnknownKeyException::class); - $this->appConfig->getValueString(TestConfigLexicon_E::APPID, 'key_exception'); + $this->appConfig->getValueString(TestLexicon_E::APPID, 'key_exception'); } public function testUserLexiconSetCorrect() { - $this->assertSame(true, $this->userConfig->setValueString('user1', TestConfigLexicon_E::APPID, 'key1', 'new_value')); - $this->assertSame(true, $this->userConfig->isLazy('user1', TestConfigLexicon_E::APPID, 'key1')); - $this->assertSame(true, $this->userConfig->isSensitive('user1', TestConfigLexicon_E::APPID, 'key1')); - $this->userConfig->deleteKey(TestConfigLexicon_E::APPID, 'key1'); + $this->assertSame(true, $this->userConfig->setValueString('user1', TestLexicon_E::APPID, 'key1', 'new_value')); + $this->assertSame(true, $this->userConfig->isLazy('user1', TestLexicon_E::APPID, 'key1')); + $this->assertSame(true, $this->userConfig->isSensitive('user1', TestLexicon_E::APPID, 'key1')); + $this->userConfig->deleteKey(TestLexicon_E::APPID, 'key1'); } public function testUserLexiconGetCorrect() { - $this->assertSame('abcde', $this->userConfig->getValueString('user1', TestConfigLexicon_E::APPID, 'key1', 'default')); + $this->assertSame('abcde', $this->userConfig->getValueString('user1', TestLexicon_E::APPID, 'key1', 'default')); } public function testUserLexiconSetIncorrectValueType() { $this->expectException(TypeConflictException::class); - $this->userConfig->setValueInt('user1', TestConfigLexicon_E::APPID, 'key1', -1); + $this->userConfig->setValueInt('user1', TestLexicon_E::APPID, 'key1', -1); } public function testUserLexiconGetIncorrectValueType() { $this->expectException(TypeConflictException::class); - $this->userConfig->getValueInt('user1', TestConfigLexicon_E::APPID, 'key1'); + $this->userConfig->getValueInt('user1', TestLexicon_E::APPID, 'key1'); } public function testUserLexiconIgnore() { @@ -135,24 +135,24 @@ class LexiconTest extends TestCase { } public function testUserLexiconNotice() { - $this->userConfig->setValueString('user1', TestConfigLexicon_N::APPID, 'key_notice', 'new_value'); - $this->assertSame('new_value', $this->userConfig->getValueString('user1', TestConfigLexicon_N::APPID, 'key_notice', '')); + $this->userConfig->setValueString('user1', TestLexicon_N::APPID, 'key_notice', 'new_value'); + $this->assertSame('new_value', $this->userConfig->getValueString('user1', TestLexicon_N::APPID, 'key_notice', '')); } public function testUserLexiconWarning() { - $this->userConfig->setValueString('user1', TestConfigLexicon_W::APPID, 'key_warning', 'new_value'); - $this->assertSame('', $this->userConfig->getValueString('user1', TestConfigLexicon_W::APPID, 'key_warning', '')); + $this->userConfig->setValueString('user1', TestLexicon_W::APPID, 'key_warning', 'new_value'); + $this->assertSame('', $this->userConfig->getValueString('user1', TestLexicon_W::APPID, 'key_warning', '')); } public function testUserLexiconSetException() { $this->expectException(UnknownKeyException::class); - $this->userConfig->setValueString('user1', TestConfigLexicon_E::APPID, 'key_exception', 'new_value'); - $this->assertSame('', $this->userConfig->getValueString('user1', TestConfigLexicon_E::APPID, 'key5', '')); + $this->userConfig->setValueString('user1', TestLexicon_E::APPID, 'key_exception', 'new_value'); + $this->assertSame('', $this->userConfig->getValueString('user1', TestLexicon_E::APPID, 'key5', '')); } public function testUserLexiconGetException() { $this->expectException(UnknownKeyException::class); - $this->userConfig->getValueString('user1', TestConfigLexicon_E::APPID, 'key_exception'); + $this->userConfig->getValueString('user1', TestLexicon_E::APPID, 'key_exception'); } public function testAppConfigLexiconRenameSetNewValue() { @@ -207,25 +207,25 @@ class LexiconTest extends TestCase { public function testAppConfigLexiconPreset() { $this->configManager->setLexiconPreset(Preset::FAMILY); - $this->assertSame('family', $this->appConfig->getValueString(TestConfigLexicon_E::APPID, 'key3')); + $this->assertSame('family', $this->appConfig->getValueString(TestLexicon_E::APPID, 'key3')); } public function testAppConfigLexiconPresets() { $this->configManager->setLexiconPreset(Preset::MEDIUM); - $this->assertSame('club+medium', $this->appConfig->getValueString(TestConfigLexicon_E::APPID, 'key3')); + $this->assertSame('club+medium', $this->appConfig->getValueString(TestLexicon_E::APPID, 'key3')); $this->configManager->setLexiconPreset(Preset::FAMILY); - $this->assertSame('family', $this->appConfig->getValueString(TestConfigLexicon_E::APPID, 'key3')); + $this->assertSame('family', $this->appConfig->getValueString(TestLexicon_E::APPID, 'key3')); } public function testUserConfigLexiconPreset() { $this->configManager->setLexiconPreset(Preset::FAMILY); - $this->assertSame('family', $this->userConfig->getValueString('user1', TestConfigLexicon_E::APPID, 'key3')); + $this->assertSame('family', $this->userConfig->getValueString('user1', TestLexicon_E::APPID, 'key3')); } public function testUserConfigLexiconPresets() { $this->configManager->setLexiconPreset(Preset::MEDIUM); - $this->assertSame('club+medium', $this->userConfig->getValueString('user1', TestConfigLexicon_E::APPID, 'key3')); + $this->assertSame('club+medium', $this->userConfig->getValueString('user1', TestLexicon_E::APPID, 'key3')); $this->configManager->setLexiconPreset(Preset::FAMILY); - $this->assertSame('family', $this->userConfig->getValueString('user1', TestConfigLexicon_E::APPID, 'key3')); + $this->assertSame('family', $this->userConfig->getValueString('user1', TestLexicon_E::APPID, 'key3')); } } diff --git a/tests/lib/Config/TestConfigLexicon_E.php b/tests/lib/Config/TestConfigLexicon_E.php deleted file mode 100644 index 197c3dc21b1..00000000000 --- a/tests/lib/Config/TestConfigLexicon_E.php +++ /dev/null @@ -1,49 +0,0 @@ -<?php - -declare(strict_types=1); -/** - * SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors - * SPDX-License-Identifier: AGPL-3.0-only - */ - -namespace Tests\lib\Config; - -use NCU\Config\IUserConfig; -use NCU\Config\Lexicon\ConfigLexiconEntry; -use NCU\Config\Lexicon\ConfigLexiconStrictness; -use NCU\Config\Lexicon\IConfigLexicon; -use NCU\Config\Lexicon\Preset; -use NCU\Config\ValueType; -use OCP\IAppConfig; - -class TestConfigLexicon_E implements IConfigLexicon { - public const APPID = 'lexicon_test_e'; - - public function getStrictness(): ConfigLexiconStrictness { - return ConfigLexiconStrictness::EXCEPTION; - } - - public function getAppConfigs(): array { - return [ - new ConfigLexiconEntry('key1', ValueType::STRING, 'abcde', 'test key', true, IAppConfig::FLAG_SENSITIVE), - new ConfigLexiconEntry('key2', ValueType::INT, 12345, 'test key', false), - new ConfigLexiconEntry('key3', ValueType::STRING, fn (Preset $p): string => match ($p) { - Preset::FAMILY => 'family', - Preset::CLUB, Preset::MEDIUM => 'club+medium', - default => 'none', - }, 'test key'), - ]; - } - - public function getUserConfigs(): array { - return [ - new ConfigLexiconEntry('key1', ValueType::STRING, 'abcde', 'test key', true, IUserConfig::FLAG_SENSITIVE), - new ConfigLexiconEntry('key2', ValueType::INT, 12345, 'test key', false), - new ConfigLexiconEntry('key3', ValueType::STRING, fn (Preset $p): string => match ($p) { - Preset::FAMILY => 'family', - Preset::CLUB, Preset::MEDIUM => 'club+medium', - default => 'none', - }, 'test key'), - ]; - } -} diff --git a/tests/lib/Config/TestConfigLexicon_I.php b/tests/lib/Config/TestConfigLexicon_I.php index 6fb7921b6e6..077a55bb4fa 100644 --- a/tests/lib/Config/TestConfigLexicon_I.php +++ b/tests/lib/Config/TestConfigLexicon_I.php @@ -8,33 +8,33 @@ declare(strict_types=1); namespace Tests\lib\Config; -use NCU\Config\IUserConfig; -use NCU\Config\Lexicon\ConfigLexiconEntry; -use NCU\Config\Lexicon\ConfigLexiconStrictness; -use NCU\Config\Lexicon\IConfigLexicon; -use NCU\Config\ValueType; +use OCP\Config\IUserConfig; +use OCP\Config\Lexicon\Entry; +use OCP\Config\Lexicon\ILexicon; +use OCP\Config\Lexicon\Strictness; +use OCP\Config\ValueType; use OCP\IAppConfig; -class TestConfigLexicon_I implements IConfigLexicon { +class TestConfigLexicon_I implements ILexicon { public const APPID = 'lexicon_test_i'; - public function getStrictness(): ConfigLexiconStrictness { - return ConfigLexiconStrictness::IGNORE; + public function getStrictness(): Strictness { + return Strictness::IGNORE; } public function getAppConfigs(): array { return [ - new ConfigLexiconEntry('key1', ValueType::STRING, 'abcde', 'test key', true, IAppConfig::FLAG_SENSITIVE), - new ConfigLexiconEntry('key2', ValueType::INT, 12345, 'test key', false), - new ConfigLexiconEntry('key3', ValueType::INT, 12345, 'test key', true, rename: 'old_key3'), - new ConfigLexiconEntry('key4', ValueType::BOOL, 12345, 'test key', true, rename: 'old_key4', options: ConfigLexiconEntry::RENAME_INVERT_BOOLEAN), + new Entry('key1', ValueType::STRING, 'abcde', 'test key', true, IAppConfig::FLAG_SENSITIVE), + new Entry('key2', ValueType::INT, 12345, 'test key', false), + new Entry('key3', ValueType::INT, 12345, 'test key', true, rename: 'old_key3'), + new Entry('key4', ValueType::BOOL, 12345, 'test key', true, rename: 'old_key4', options: Entry::RENAME_INVERT_BOOLEAN), ]; } public function getUserConfigs(): array { return [ - new ConfigLexiconEntry('key1', ValueType::STRING, 'abcde', 'test key', true, IUserConfig::FLAG_SENSITIVE), - new ConfigLexiconEntry('key2', ValueType::INT, 12345, 'test key', false) + new Entry('key1', ValueType::STRING, 'abcde', 'test key', true, IUserConfig::FLAG_SENSITIVE), + new Entry('key2', ValueType::INT, 12345, 'test key', false) ]; } diff --git a/tests/lib/Config/TestConfigLexicon_N.php b/tests/lib/Config/TestConfigLexicon_N.php deleted file mode 100644 index 4d96fe9b10d..00000000000 --- a/tests/lib/Config/TestConfigLexicon_N.php +++ /dev/null @@ -1,39 +0,0 @@ -<?php - -declare(strict_types=1); -/** - * SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors - * SPDX-License-Identifier: AGPL-3.0-only - */ - -namespace Tests\lib\Config; - -use NCU\Config\IUserConfig; -use NCU\Config\Lexicon\ConfigLexiconEntry; -use NCU\Config\Lexicon\ConfigLexiconStrictness; -use NCU\Config\Lexicon\IConfigLexicon; -use NCU\Config\ValueType; -use OCP\IAppConfig; - -class TestConfigLexicon_N implements IConfigLexicon { - public const APPID = 'lexicon_test_n'; - - public function getStrictness(): ConfigLexiconStrictness { - return ConfigLexiconStrictness::NOTICE; - } - - public function getAppConfigs(): array { - return [ - new ConfigLexiconEntry('key1', ValueType::STRING, 'abcde', 'test key', true, IAppConfig::FLAG_SENSITIVE), - new ConfigLexiconEntry('key2', ValueType::INT, 12345, 'test key', false) - ]; - } - - public function getUserConfigs(): array { - return [ - new ConfigLexiconEntry('key1', ValueType::STRING, 'abcde', 'test key', true, IUserConfig::FLAG_SENSITIVE), - new ConfigLexiconEntry('key2', ValueType::INT, 12345, 'test key', false) - ]; - } - -} diff --git a/tests/lib/Config/TestConfigLexicon_W.php b/tests/lib/Config/TestConfigLexicon_W.php deleted file mode 100644 index d4242db0682..00000000000 --- a/tests/lib/Config/TestConfigLexicon_W.php +++ /dev/null @@ -1,39 +0,0 @@ -<?php - -declare(strict_types=1); -/** - * SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors - * SPDX-License-Identifier: AGPL-3.0-only - */ - -namespace Tests\lib\Config; - -use NCU\Config\IUserConfig; -use NCU\Config\Lexicon\ConfigLexiconEntry; -use NCU\Config\Lexicon\ConfigLexiconStrictness; -use NCU\Config\Lexicon\IConfigLexicon; -use NCU\Config\ValueType; -use OCP\IAppConfig; - -class TestConfigLexicon_W implements IConfigLexicon { - public const APPID = 'lexicon_test_w'; - - public function getStrictness(): ConfigLexiconStrictness { - return ConfigLexiconStrictness::WARNING; - } - - public function getAppConfigs(): array { - return [ - new ConfigLexiconEntry('key1', ValueType::STRING, 'abcde', 'test key', true, IAppConfig::FLAG_SENSITIVE), - new ConfigLexiconEntry('key2', ValueType::INT, 12345, 'test key', false) - - ]; - } - - public function getUserConfigs(): array { - return [ - new ConfigLexiconEntry('key1', ValueType::STRING, 'abcde', 'test key', true, IUserConfig::FLAG_SENSITIVE), - new ConfigLexiconEntry('key2', ValueType::INT, 12345, 'test key', false) ]; - } - -} diff --git a/tests/lib/Config/TestLexicon_E.php b/tests/lib/Config/TestLexicon_E.php new file mode 100644 index 00000000000..ccdc8cdd037 --- /dev/null +++ b/tests/lib/Config/TestLexicon_E.php @@ -0,0 +1,49 @@ +<?php + +declare(strict_types=1); +/** + * SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors + * SPDX-License-Identifier: AGPL-3.0-only + */ + +namespace Tests\lib\Config; + +use OCP\Config\IUserConfig; +use OCP\Config\Lexicon\Entry; +use OCP\Config\Lexicon\ILexicon; +use OCP\Config\Lexicon\Preset; +use OCP\Config\Lexicon\Strictness; +use OCP\Config\ValueType; +use OCP\IAppConfig; + +class TestLexicon_E implements ILexicon { + public const APPID = 'lexicon_test_e'; + + public function getStrictness(): Strictness { + return Strictness::EXCEPTION; + } + + public function getAppConfigs(): array { + return [ + new Entry('key1', ValueType::STRING, 'abcde', 'test key', true, IAppConfig::FLAG_SENSITIVE), + new Entry('key2', ValueType::INT, 12345, 'test key', false), + new Entry('key3', ValueType::STRING, fn (Preset $p): string => match ($p) { + Preset::FAMILY => 'family', + Preset::CLUB, Preset::MEDIUM => 'club+medium', + default => 'none', + }, 'test key'), + ]; + } + + public function getUserConfigs(): array { + return [ + new Entry('key1', ValueType::STRING, 'abcde', 'test key', true, IUserConfig::FLAG_SENSITIVE), + new Entry('key2', ValueType::INT, 12345, 'test key', false), + new Entry('key3', ValueType::STRING, fn (Preset $p): string => match ($p) { + Preset::FAMILY => 'family', + Preset::CLUB, Preset::MEDIUM => 'club+medium', + default => 'none', + }, 'test key'), + ]; + } +} diff --git a/tests/lib/Config/TestLexicon_N.php b/tests/lib/Config/TestLexicon_N.php new file mode 100644 index 00000000000..87be2149371 --- /dev/null +++ b/tests/lib/Config/TestLexicon_N.php @@ -0,0 +1,39 @@ +<?php + +declare(strict_types=1); +/** + * SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors + * SPDX-License-Identifier: AGPL-3.0-only + */ + +namespace Tests\lib\Config; + +use OCP\Config\IUserConfig; +use OCP\Config\Lexicon\Entry; +use OCP\Config\Lexicon\ILexicon; +use OCP\Config\Lexicon\Strictness; +use OCP\Config\ValueType; +use OCP\IAppConfig; + +class TestLexicon_N implements ILexicon { + public const APPID = 'lexicon_test_n'; + + public function getStrictness(): Strictness { + return Strictness::NOTICE; + } + + public function getAppConfigs(): array { + return [ + new Entry('key1', ValueType::STRING, 'abcde', 'test key', true, IAppConfig::FLAG_SENSITIVE), + new Entry('key2', ValueType::INT, 12345, 'test key', false) + ]; + } + + public function getUserConfigs(): array { + return [ + new Entry('key1', ValueType::STRING, 'abcde', 'test key', true, IUserConfig::FLAG_SENSITIVE), + new Entry('key2', ValueType::INT, 12345, 'test key', false) + ]; + } + +} diff --git a/tests/lib/Config/TestLexicon_W.php b/tests/lib/Config/TestLexicon_W.php new file mode 100644 index 00000000000..32227eb1c80 --- /dev/null +++ b/tests/lib/Config/TestLexicon_W.php @@ -0,0 +1,39 @@ +<?php + +declare(strict_types=1); +/** + * SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors + * SPDX-License-Identifier: AGPL-3.0-only + */ + +namespace Tests\lib\Config; + +use OCP\Config\IUserConfig; +use OCP\Config\Lexicon\Entry; +use OCP\Config\Lexicon\ILexicon; +use OCP\Config\Lexicon\Strictness; +use OCP\Config\ValueType; +use OCP\IAppConfig; + +class TestLexicon_W implements ILexicon { + public const APPID = 'lexicon_test_w'; + + public function getStrictness(): Strictness { + return Strictness::WARNING; + } + + public function getAppConfigs(): array { + return [ + new Entry('key1', ValueType::STRING, 'abcde', 'test key', true, IAppConfig::FLAG_SENSITIVE), + new Entry('key2', ValueType::INT, 12345, 'test key', false) + + ]; + } + + public function getUserConfigs(): array { + return [ + new Entry('key1', ValueType::STRING, 'abcde', 'test key', true, IUserConfig::FLAG_SENSITIVE), + new Entry('key2', ValueType::INT, 12345, 'test key', false) ]; + } + +} diff --git a/tests/lib/Config/UserConfigTest.php b/tests/lib/Config/UserConfigTest.php index 2c8222576c4..5666a441b93 100644 --- a/tests/lib/Config/UserConfigTest.php +++ b/tests/lib/Config/UserConfigTest.php @@ -7,11 +7,11 @@ declare(strict_types=1); */ namespace Test\lib\Config; -use NCU\Config\Exceptions\TypeConflictException; -use NCU\Config\Exceptions\UnknownKeyException; -use NCU\Config\IUserConfig; -use NCU\Config\ValueType; use OC\Config\UserConfig; +use OCP\Config\Exceptions\TypeConflictException; +use OCP\Config\Exceptions\UnknownKeyException; +use OCP\Config\IUserConfig; +use OCP\Config\ValueType; use OCP\IConfig; use OCP\IDBConnection; use OCP\Security\ICrypto; |