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:
Philipp 2023-01-11 21:53:34 +01:00
parent fd882abd80
commit 11a8bd17e3
No known key found for this signature in database
GPG key ID: 24A7501396EB5432
5 changed files with 65 additions and 42 deletions

View file

@ -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'));
}
/**