Adding ConfigCacheTest

This commit is contained in:
Philipp Holzer
2019-02-10 12:30:13 +01:00
parent b6e2c254fb
commit 2a42f8dded
3 changed files with 185 additions and 3 deletions

View File

@@ -2,8 +2,6 @@
namespace Friendica\Core\Config;
use Friendica\Database\DBA;
abstract class AbstractDbaConfigAdapter
{
/** @var bool */

View File

@@ -18,7 +18,7 @@ class ConfigCache implements IConfigCache, IPConfigCache
*/
public function __construct(array $config = [])
{
$this->config = $config;
$this->loadConfigArray($config);
}
/**
@@ -110,6 +110,9 @@ class ConfigCache implements IConfigCache, IPConfigCache
} else {
if (isset($this->config[$cat][$key])) {
unset($this->config[$cat][$key]);
if (count($this->config[$cat]) == 0) {
unset($this->config[$cat]);
}
}
}
}
@@ -160,6 +163,12 @@ class ConfigCache implements IConfigCache, IPConfigCache
{
if (isset($this->config[$uid][$cat][$key])) {
unset($this->config[$uid][$cat][$key]);
if (count($this->config[$uid][$cat]) == 0) {
unset($this->config[$uid][$cat]);
if (count($this->config[$uid]) == 0) {
unset($this->config[$uid]);
}
}
}
}