1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
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'),
];
}
}
|