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

@ -576,4 +576,25 @@ class CacheTest extends MockedTest
$cache->delete('config', 'a');
self::assertArrayNotHasKey('config', $cache->getAll());
}
/**
* Test that deleted keys are working with merge
*
* @dataProvider dataTests
*/
public function testDeleteAndMergeWithDefault($data)
{
$cache = new Cache();
$cache->load($data, Cache::SOURCE_FILE);
$cache2 = new Cache();
$cache2->set('system', 'test', 'overrride');
$cache2->delete('system', 'test');
self::assertEquals('it', $cache->get('system', 'test'));
self::assertNull($cache2->get('system', 'test'));
$mergedCache = $cache->merge($cache2);
self::assertNull($mergedCache->get('system', 'test'));
}
}