mirror of
https://github.com/friendica/friendica
synced 2025-04-22 09:10:10 +00:00
Use addons config entries instead of the addon table
This commit is contained in:
parent
cd11088cc4
commit
13b234d279
7 changed files with 294 additions and 39 deletions
|
@ -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));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue