]>
git.immae.eu Git - github/shaarli/Shaarli.git/blob - tests/utils/FakeConfigManager.php
6 class FakeConfigManager
8 protected $values = [];
11 * Initialize with test values
13 * @param array $values Initial values
15 public function __construct($values = [])
17 $this->values
= $values;
23 * @param string $key Key of the value to set
24 * @param mixed $value Value to set
26 public function set($key, $value)
28 $this->values
[$key] = $value;
32 * Get a given configuration value
34 * @param string $key Index of the value to retrieve
36 * @return mixed The value if set, else the name of the key
38 public function get($key)
40 if (isset($this->values
[$key])) {
41 return $this->values
[$key];
47 * Check if a setting exists
49 * @param string $setting Asked setting, keys separated with dots
51 * @return bool true if the setting exists, false otherwise
53 public function exists($setting)
55 return array_key_exists($setting, $this->values
);