5 use Shaarli\Config\ConfigManager
;
10 class FakeConfigManager
extends ConfigManager
12 protected $values = [];
15 * Initialize with test values
17 * @param array $values Initial values
19 public function __construct($values = [])
21 $this->values
= $values;
27 * @param string $key Key of the value to set
28 * @param mixed $value Value to set
30 public function set($key, $value, $write = false, $isLoggedIn = false)
32 $this->values
[$key] = $value;
36 * Get a given configuration value
38 * @param string $key Index of the value to retrieve
40 * @return mixed The value if set, else the name of the key
42 public function get($key, $default = '')
44 if (isset($this->values
[$key])) {
45 return $this->values
[$key];
51 * Check if a setting exists
53 * @param string $setting Asked setting, keys separated with dots
55 * @return bool true if the setting exists, false otherwise
57 public function exists($setting)
59 return array_key_exists($setting, $this->values
);