mirror of
https://git.friendi.ca/friendica/friendica.git
synced 2025-06-08 00:54:26 +02:00
Assure that deleted cat/keys are working as expected
- A deleted cache-key would delete a merged cache-key as well - Deleting a key in the Model results in reloading the config to assure any value from underlying files
This commit is contained in:
parent
fd882abd80
commit
11a8bd17e3
5 changed files with 65 additions and 42 deletions
|
@ -443,7 +443,7 @@ class ConfigFileManagerTest extends MockedTest
|
|||
}
|
||||
|
||||
/**
|
||||
* If we delete something with the Cache::delete() functionality, be sure to override the underlying source as well
|
||||
* If we delete something with the Cache::delete() functionality, be sure to probably reset it to the underlying key
|
||||
*/
|
||||
public function testDeleteKeyOverwrite()
|
||||
{
|
||||
|
@ -465,51 +465,16 @@ class ConfigFileManagerTest extends MockedTest
|
|||
|
||||
$configFileManager->setupCache($configCache);
|
||||
|
||||
$configCache->delete('system', 'default_timezone', Cache::SOURCE_DATA);
|
||||
$configCache->delete('system', 'default_timezone');
|
||||
|
||||
$configFileManager->saveData($configCache);
|
||||
|
||||
// assert that system.default_timezone is now null, even it's set with settings.conf.php
|
||||
// assert that system.default_timezone is now the restored 'UTC' from the defaults
|
||||
$configCache = new Cache();
|
||||
|
||||
$configFileManager->setupCache($configCache);
|
||||
|
||||
self::assertNull($configCache->get('system', 'default_timezone'));
|
||||
}
|
||||
|
||||
/**
|
||||
* If we delete something with the Cache::delete() functionality, be sure to override the underlying source as well
|
||||
*/
|
||||
public function testDeleteCategoryOverwrite()
|
||||
{
|
||||
$this->delConfigFile('node.config.php');
|
||||
|
||||
$fileDir = dirname(__DIR__) . DIRECTORY_SEPARATOR .
|
||||
'..' . DIRECTORY_SEPARATOR .
|
||||
'..' . DIRECTORY_SEPARATOR .
|
||||
'..' . DIRECTORY_SEPARATOR .
|
||||
'datasets' . DIRECTORY_SEPARATOR .
|
||||
'config' . DIRECTORY_SEPARATOR;
|
||||
|
||||
vfsStream::newFile('B.config.php')
|
||||
->at($this->root->getChild('config'))
|
||||
->setContent(file_get_contents($fileDir . 'B.config.php'));
|
||||
|
||||
$configFileManager = (new Config())->createConfigFileManager($this->root->url());
|
||||
$configCache = new Cache();
|
||||
|
||||
$configFileManager->setupCache($configCache);
|
||||
|
||||
$configCache->delete('system');
|
||||
|
||||
$configFileManager->saveData($configCache);
|
||||
|
||||
// assert that system.default_timezone is now null, even it's set with settings.conf.php
|
||||
$configCache = new Cache();
|
||||
|
||||
$configFileManager->setupCache($configCache);
|
||||
|
||||
self::assertNull($configCache->get('system', 'default_timezone'));
|
||||
self::assertEquals('UTC', $configCache->get('system', 'default_timezone'));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue