diff options
author | VirtualTam <virtualtam+github@flibidi.net> | 2018-02-05 18:16:32 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-02-05 18:16:32 +0100 |
commit | 91f17fc92a7168e2baf1096910b8f44f3a24a8a2 (patch) | |
tree | 2c211d422b9d6c27ab341644531913361b6f1024 /tests/utils/FakeConfigManager.php | |
parent | a381c373b30ed04001ea31ff5c38e077edacaf18 (diff) | |
parent | 44acf706812bc77812e6648c2cc28af36e172a14 (diff) | |
download | Shaarli-91f17fc92a7168e2baf1096910b8f44f3a24a8a2.tar.gz Shaarli-91f17fc92a7168e2baf1096910b8f44f3a24a8a2.tar.zst Shaarli-91f17fc92a7168e2baf1096910b8f44f3a24a8a2.zip |
Merge pull request #1008 from virtualtam/refactor/authentication
Refactor login / ban management
Diffstat (limited to 'tests/utils/FakeConfigManager.php')
-rw-r--r-- | tests/utils/FakeConfigManager.php | 35 |
1 files changed, 34 insertions, 1 deletions
diff --git a/tests/utils/FakeConfigManager.php b/tests/utils/FakeConfigManager.php index f29760cb..85434de7 100644 --- a/tests/utils/FakeConfigManager.php +++ b/tests/utils/FakeConfigManager.php | |||
@@ -5,8 +5,41 @@ | |||
5 | */ | 5 | */ |
6 | class FakeConfigManager | 6 | class FakeConfigManager |
7 | { | 7 | { |
8 | public static function get($key) | 8 | protected $values = []; |
9 | |||
10 | /** | ||
11 | * Initialize with test values | ||
12 | * | ||
13 | * @param array $values Initial values | ||
14 | */ | ||
15 | public function __construct($values = []) | ||
16 | { | ||
17 | $this->values = $values; | ||
18 | } | ||
19 | |||
20 | /** | ||
21 | * Set a given value | ||
22 | * | ||
23 | * @param string $key Key of the value to set | ||
24 | * @param mixed $value Value to set | ||
25 | */ | ||
26 | public function set($key, $value) | ||
27 | { | ||
28 | $this->values[$key] = $value; | ||
29 | } | ||
30 | |||
31 | /** | ||
32 | * Get a given configuration value | ||
33 | * | ||
34 | * @param string $key Index of the value to retrieve | ||
35 | * | ||
36 | * @return mixed The value if set, else the name of the key | ||
37 | */ | ||
38 | public function get($key) | ||
9 | { | 39 | { |
40 | if (isset($this->values[$key])) { | ||
41 | return $this->values[$key]; | ||
42 | } | ||
10 | return $key; | 43 | return $key; |
11 | } | 44 | } |
12 | } | 45 | } |