mirror of
https://github.com/friendica/friendica
synced 2025-04-22 17:50:11 +00:00
Splitting ConfigCache & PConfigCache
- Remove IConfigCache & IPConfigCache - Add new PConfigCache - Add missing Logger::init() (bugfixing tests)
This commit is contained in:
parent
b56709d802
commit
c82127ffb7
27 changed files with 527 additions and 334 deletions
|
@ -29,15 +29,11 @@ class ConfigCacheTest extends MockedTest
|
|||
];
|
||||
}
|
||||
|
||||
private function assertConfigValues($data, ConfigCache $configCache, $uid = null)
|
||||
private function assertConfigValues($data, ConfigCache $configCache)
|
||||
{
|
||||
foreach ($data as $cat => $values) {
|
||||
foreach ($values as $key => $value) {
|
||||
if (isset($uid)) {
|
||||
$this->assertEquals($data[$cat][$key], $configCache->getP($uid, $cat, $key));
|
||||
} else {
|
||||
$this->assertEquals($data[$cat][$key], $configCache->get($cat, $key));
|
||||
}
|
||||
$this->assertEquals($data[$cat][$key], $configCache->get($cat, $key));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -180,73 +176,6 @@ class ConfigCacheTest extends MockedTest
|
|||
$this->assertEmpty($configCache->getAll());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test the setP() and getP() methods
|
||||
* @dataProvider dataTests
|
||||
*/
|
||||
public function testSetGetP($data)
|
||||
{
|
||||
$configCache = new ConfigCache();
|
||||
$uid = 345;
|
||||
|
||||
foreach ($data as $cat => $values) {
|
||||
foreach ($values as $key => $value) {
|
||||
$configCache->setP($uid, $cat, $key, $value);
|
||||
}
|
||||
}
|
||||
|
||||
$this->assertConfigValues($data, $configCache, $uid);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Test the getP() method with a category
|
||||
*/
|
||||
public function testGetPCat()
|
||||
{
|
||||
$configCache = new ConfigCache();
|
||||
$uid = 345;
|
||||
|
||||
$configCache->loadP($uid, [
|
||||
'system' => [
|
||||
'key1' => 'value1',
|
||||
'key2' => 'value2',
|
||||
],
|
||||
'config' => [
|
||||
'key3' => 'value3',
|
||||
],
|
||||
]);
|
||||
|
||||
$this->assertEquals([
|
||||
'key1' => 'value1',
|
||||
'key2' => 'value2',
|
||||
], $configCache->get($uid, 'system'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Test the deleteP() method
|
||||
* @dataProvider dataTests
|
||||
*/
|
||||
public function testDeleteP($data)
|
||||
{
|
||||
$configCache = new ConfigCache();
|
||||
$uid = 345;
|
||||
|
||||
foreach ($data as $cat => $values) {
|
||||
foreach ($values as $key => $value) {
|
||||
$configCache->setP($uid, $cat, $key, $value);
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($data as $cat => $values) {
|
||||
foreach ($values as $key => $value) {
|
||||
$configCache->deleteP($uid, $cat, $key);
|
||||
}
|
||||
}
|
||||
|
||||
$this->assertEmpty($configCache->getAll());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test the keyDiff() method with result
|
||||
* @dataProvider dataTests
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue