Use addons config entries instead of the addon table

This commit is contained in:
Philipp 2023-01-03 20:24:48 +01:00
parent cd11088cc4
commit 13b234d279
No known key found for this signature in database
GPG key ID: 24A7501396EB5432
7 changed files with 294 additions and 39 deletions

View file

@ -403,4 +403,133 @@ class ConfigTest extends MockedTest
self::assertFalse($this->testedConfig->set('config', 'test', '123'));
self::assertEquals('prio', $this->testedConfig->get('config', 'test', '', true));
}
public function dataTestCat()
{
return [
'test_with_hashmap' => [
'data' => [
'test_with_hashmap' => [
'notifyall' => [
'last_update' => 1671051565,
'admin' => true,
],
'blockbot' => [
'last_update' => 1658952852,
'admin' => true,
],
],
'config' => [
'register_policy' => 2,
'register_text' => '',
'sitename' => 'Friendica Social Network23',
'hostname' => 'friendica.local',
'private_addons' => false,
],
'system' => [
'dbclean_expire_conversation' => 90,
],
],
'cat' => 'test_with_hashmap',
'assertion' => [
'notifyall' => [
'last_update' => 1671051565,
'admin' => true,
],
'blockbot' => [
'last_update' => 1658952852,
'admin' => true,
],
],
],
'test_with_keys' => [
'data' => [
'test_with_keys' => [
[
'last_update' => 1671051565,
'admin' => true,
],
[
'last_update' => 1658952852,
'admin' => true,
],
],
'config' => [
'register_policy' => 2,
'register_text' => '',
'sitename' => 'Friendica Social Network23',
'hostname' => 'friendica.local',
'private_addons' => false,
],
'system' => [
'dbclean_expire_conversation' => 90,
],
],
'cat' => 'test_with_keys',
'assertion' => [
[
'last_update' => 1671051565,
'admin' => true,
],
[
'last_update' => 1658952852,
'admin' => true,
],
],
],
'test_with_inner_array' => [
'data' => [
'test_with_inner_array' => [
'notifyall' => [
'last_update' => 1671051565,
'admin' => [
'yes' => true,
'no' => 1.5,
],
],
'blogbot' => [
'last_update' => 1658952852,
'admin' => true,
],
],
'config' => [
'register_policy' => 2,
'register_text' => '',
'sitename' => 'Friendica Social Network23',
'hostname' => 'friendica.local',
'private_addons' => false,
],
'system' => [
'dbclean_expire_conversation' => 90,
],
],
'cat' => 'test_with_inner_array',
'assertion' => [
'notifyall' => [
'last_update' => 1671051565,
'admin' => [
'yes' => true,
'no' => 1.5,
],
],
'blogbot' => [
'last_update' => 1658952852,
'admin' => true,
],
],
],
];
}
/**
* @dataProvider dataTestCat
*/
public function testGetCategory(array $data, string $category, array $assertion)
{
$this->configCache = new Cache($data);
$config = new Config($this->configFileManager, $this->configCache);
self::assertEquals($assertion, $config->get($category));
}
}