mirror of
https://github.com/friendica/friendica
synced 2025-02-21 07:26:48 +00:00
Fix code style
This commit is contained in:
parent
a006aba9d4
commit
86516d8b28
10 changed files with 92 additions and 104 deletions
|
@ -46,7 +46,7 @@ final class AddonProxy implements AddonHelper
|
||||||
public function getAvailableAddons(): array
|
public function getAvailableAddons(): array
|
||||||
{
|
{
|
||||||
return array_map(
|
return array_map(
|
||||||
function(array $item) {
|
function (array $item) {
|
||||||
return $item[0];
|
return $item[0];
|
||||||
},
|
},
|
||||||
Addon::getAvailableList()
|
Addon::getAvailableList()
|
||||||
|
|
|
@ -123,7 +123,7 @@ class ConfigFileManager
|
||||||
|
|
||||||
if (file_exists($configName)) {
|
if (file_exists($configName)) {
|
||||||
return $this->loadConfigFile($configName);
|
return $this->loadConfigFile($configName);
|
||||||
} else if (file_exists($iniName)) {
|
} elseif (file_exists($iniName)) {
|
||||||
return $this->loadINIConfigFile($iniName);
|
return $this->loadINIConfigFile($iniName);
|
||||||
} else {
|
} else {
|
||||||
return [];
|
return [];
|
||||||
|
|
|
@ -60,9 +60,9 @@ class Index extends BaseAdmin
|
||||||
$addonInfo = $addonHelper->getAddonInfo($addonId);
|
$addonInfo = $addonHelper->getAddonInfo($addonId);
|
||||||
|
|
||||||
$info = [
|
$info = [
|
||||||
'name' => $addonInfo->getName(),
|
'name' => $addonInfo->getName(),
|
||||||
'description' => $addonInfo->getDescription(),
|
'description' => $addonInfo->getDescription(),
|
||||||
'version' => $addonInfo->getVersion(),
|
'version' => $addonInfo->getVersion(),
|
||||||
];
|
];
|
||||||
|
|
||||||
$addons[] = [
|
$addons[] = [
|
||||||
|
|
|
@ -68,32 +68,32 @@ abstract class BaseAdmin extends BaseModule
|
||||||
// not part of $aside to make the template more adjustable
|
// not part of $aside to make the template more adjustable
|
||||||
$aside_sub = [
|
$aside_sub = [
|
||||||
'information' => [DI::l10n()->t('Information'), [
|
'information' => [DI::l10n()->t('Information'), [
|
||||||
'overview' => ['admin' , DI::l10n()->t('Overview') , 'overview'],
|
'overview' => ['admin' , DI::l10n()->t('Overview') , 'overview'],
|
||||||
'federation' => ['admin/federation' , DI::l10n()->t('Federation Statistics') , 'federation']
|
'federation' => ['admin/federation' , DI::l10n()->t('Federation Statistics') , 'federation']
|
||||||
]],
|
]],
|
||||||
'configuration' => [DI::l10n()->t('Configuration'), [
|
'configuration' => [DI::l10n()->t('Configuration'), [
|
||||||
'site' => ['admin/site' , DI::l10n()->t('Site') , 'site'],
|
'site' => ['admin/site' , DI::l10n()->t('Site') , 'site'],
|
||||||
'storage' => ['admin/storage' , DI::l10n()->t('Storage') , 'storage'],
|
'storage' => ['admin/storage' , DI::l10n()->t('Storage') , 'storage'],
|
||||||
'addons' => ['admin/addons' , DI::l10n()->t('Addons') , 'addons'],
|
'addons' => ['admin/addons' , DI::l10n()->t('Addons') , 'addons'],
|
||||||
'themes' => ['admin/themes' , DI::l10n()->t('Themes') , 'themes'],
|
'themes' => ['admin/themes' , DI::l10n()->t('Themes') , 'themes'],
|
||||||
'features' => ['admin/features' , DI::l10n()->t('Additional features') , 'features'],
|
'features' => ['admin/features' , DI::l10n()->t('Additional features') , 'features'],
|
||||||
'tos' => ['admin/tos' , DI::l10n()->t('Terms of Service') , 'tos'],
|
'tos' => ['admin/tos' , DI::l10n()->t('Terms of Service') , 'tos'],
|
||||||
]],
|
]],
|
||||||
'database' => [DI::l10n()->t('Database'), [
|
'database' => [DI::l10n()->t('Database'), [
|
||||||
'dbsync' => ['admin/dbsync' , DI::l10n()->t('DB updates') , 'dbsync'],
|
'dbsync' => ['admin/dbsync' , DI::l10n()->t('DB updates') , 'dbsync'],
|
||||||
'deferred' => ['admin/queue/deferred', DI::l10n()->t('Inspect Deferred Workers'), 'deferred'],
|
'deferred' => ['admin/queue/deferred', DI::l10n()->t('Inspect Deferred Workers'), 'deferred'],
|
||||||
'workerqueue' => ['admin/queue' , DI::l10n()->t('Inspect worker Queue') , 'workerqueue'],
|
'workerqueue' => ['admin/queue' , DI::l10n()->t('Inspect worker Queue') , 'workerqueue'],
|
||||||
]],
|
]],
|
||||||
'logs' => [DI::l10n()->t('Logs'), [
|
'logs' => [DI::l10n()->t('Logs'), [
|
||||||
'logsconfig' => ['admin/logs/', DI::l10n()->t('Logs') , 'logs'],
|
'logsconfig' => ['admin/logs/', DI::l10n()->t('Logs') , 'logs'],
|
||||||
'logsview' => ['admin/logs/view' , DI::l10n()->t('View Logs') , 'viewlogs'],
|
'logsview' => ['admin/logs/view' , DI::l10n()->t('View Logs') , 'viewlogs'],
|
||||||
]],
|
]],
|
||||||
'diagnostics' => [DI::l10n()->t('Diagnostics'), [
|
'diagnostics' => [DI::l10n()->t('Diagnostics'), [
|
||||||
'phpinfo' => ['admin/phpinfo?t=' . self::getFormSecurityToken('phpinfo'), DI::l10n()->t('PHP Info') , 'phpinfo'],
|
'phpinfo' => ['admin/phpinfo?t=' . self::getFormSecurityToken('phpinfo'), DI::l10n()->t('PHP Info') , 'phpinfo'],
|
||||||
'probe' => ['probe' , DI::l10n()->t('probe address') , 'probe'],
|
'probe' => ['probe' , DI::l10n()->t('probe address') , 'probe'],
|
||||||
'webfinger' => ['webfinger' , DI::l10n()->t('check webfinger') , 'webfinger'],
|
'webfinger' => ['webfinger' , DI::l10n()->t('check webfinger') , 'webfinger'],
|
||||||
'babel' => ['babel' , DI::l10n()->t('Babel') , 'babel'],
|
'babel' => ['babel' , DI::l10n()->t('Babel') , 'babel'],
|
||||||
'debug/ap' => ['debug/ap' , DI::l10n()->t('ActivityPub Conversion') , 'debug/ap'],
|
'debug/ap' => ['debug/ap' , DI::l10n()->t('ActivityPub Conversion') , 'debug/ap'],
|
||||||
]],
|
]],
|
||||||
];
|
];
|
||||||
|
|
||||||
|
@ -109,12 +109,12 @@ abstract class BaseAdmin extends BaseModule
|
||||||
|
|
||||||
$t = Renderer::getMarkupTemplate('admin/aside.tpl');
|
$t = Renderer::getMarkupTemplate('admin/aside.tpl');
|
||||||
DI::page()['aside'] .= Renderer::replaceMacros($t, [
|
DI::page()['aside'] .= Renderer::replaceMacros($t, [
|
||||||
'$admin' => ['addons_admin' => $addons_admin],
|
'$admin' => ['addons_admin' => $addons_admin],
|
||||||
'$subpages' => $aside_sub,
|
'$subpages' => $aside_sub,
|
||||||
'$admtxt' => DI::l10n()->t('Admin'),
|
'$admtxt' => DI::l10n()->t('Admin'),
|
||||||
'$plugadmtxt' => DI::l10n()->t('Addon Features'),
|
'$plugadmtxt' => DI::l10n()->t('Addon Features'),
|
||||||
'$h_pending' => DI::l10n()->t('User registrations waiting for confirmation'),
|
'$h_pending' => DI::l10n()->t('User registrations waiting for confirmation'),
|
||||||
'$admurl' => 'admin/'
|
'$admurl' => 'admin/'
|
||||||
]);
|
]);
|
||||||
|
|
||||||
return '';
|
return '';
|
||||||
|
|
|
@ -15,8 +15,6 @@ use Friendica\Database\Definition\DbaDefinition;
|
||||||
use Friendica\Database\Definition\ViewDefinition;
|
use Friendica\Database\Definition\ViewDefinition;
|
||||||
use Friendica\Test\DatabaseTestTrait;
|
use Friendica\Test\DatabaseTestTrait;
|
||||||
use Friendica\Test\Util\Database\StaticDatabase;
|
use Friendica\Test\Util\Database\StaticDatabase;
|
||||||
use Friendica\Util\Profiler;
|
|
||||||
use Psr\Log\NullLogger;
|
|
||||||
|
|
||||||
trait CreateDatabaseTrait
|
trait CreateDatabaseTrait
|
||||||
{
|
{
|
||||||
|
@ -38,7 +36,7 @@ trait CreateDatabaseTrait
|
||||||
$this->root->url() . '/config',
|
$this->root->url() . '/config',
|
||||||
$this->root->url() . '/static'
|
$this->root->url() . '/static'
|
||||||
);
|
);
|
||||||
$config = new ReadOnlyFileConfig(new Cache([
|
$config = new ReadOnlyFileConfig(new Cache([
|
||||||
'database' => [
|
'database' => [
|
||||||
'disable_pdo' => true
|
'disable_pdo' => true
|
||||||
],
|
],
|
||||||
|
|
|
@ -66,7 +66,7 @@ class ConfigFileManagerTest extends MockedTestCase
|
||||||
$this->root->url() . DIRECTORY_SEPARATOR . Config::CONFIG_DIR,
|
$this->root->url() . DIRECTORY_SEPARATOR . Config::CONFIG_DIR,
|
||||||
$this->root->url() . DIRECTORY_SEPARATOR . Config::STATIC_DIR
|
$this->root->url() . DIRECTORY_SEPARATOR . Config::STATIC_DIR
|
||||||
);
|
);
|
||||||
$configCache = new Cache();
|
$configCache = new Cache();
|
||||||
|
|
||||||
$configFileLoader->setupCache($configCache);
|
$configFileLoader->setupCache($configCache);
|
||||||
}
|
}
|
||||||
|
@ -96,7 +96,7 @@ class ConfigFileManagerTest extends MockedTestCase
|
||||||
$this->root->url() . DIRECTORY_SEPARATOR . Config::CONFIG_DIR,
|
$this->root->url() . DIRECTORY_SEPARATOR . Config::CONFIG_DIR,
|
||||||
$this->root->url() . DIRECTORY_SEPARATOR . Config::STATIC_DIR
|
$this->root->url() . DIRECTORY_SEPARATOR . Config::STATIC_DIR
|
||||||
);
|
);
|
||||||
$configCache = new Cache();
|
$configCache = new Cache();
|
||||||
|
|
||||||
$configFileLoader->setupCache($configCache);
|
$configFileLoader->setupCache($configCache);
|
||||||
|
|
||||||
|
@ -134,7 +134,7 @@ class ConfigFileManagerTest extends MockedTestCase
|
||||||
$this->root->url() . DIRECTORY_SEPARATOR . Config::CONFIG_DIR,
|
$this->root->url() . DIRECTORY_SEPARATOR . Config::CONFIG_DIR,
|
||||||
$this->root->url() . DIRECTORY_SEPARATOR . Config::STATIC_DIR
|
$this->root->url() . DIRECTORY_SEPARATOR . Config::STATIC_DIR
|
||||||
);
|
);
|
||||||
$configCache = new Cache();
|
$configCache = new Cache();
|
||||||
|
|
||||||
$configFileLoader->setupCache($configCache);
|
$configFileLoader->setupCache($configCache);
|
||||||
|
|
||||||
|
@ -171,7 +171,7 @@ class ConfigFileManagerTest extends MockedTestCase
|
||||||
$this->root->url() . DIRECTORY_SEPARATOR . Config::CONFIG_DIR,
|
$this->root->url() . DIRECTORY_SEPARATOR . Config::CONFIG_DIR,
|
||||||
$this->root->url() . DIRECTORY_SEPARATOR . Config::STATIC_DIR
|
$this->root->url() . DIRECTORY_SEPARATOR . Config::STATIC_DIR
|
||||||
);
|
);
|
||||||
$configCache = new Cache();
|
$configCache = new Cache();
|
||||||
|
|
||||||
$configFileLoader->setupCache($configCache);
|
$configFileLoader->setupCache($configCache);
|
||||||
|
|
||||||
|
@ -264,7 +264,7 @@ class ConfigFileManagerTest extends MockedTestCase
|
||||||
$this->root->url() . DIRECTORY_SEPARATOR . Config::CONFIG_DIR,
|
$this->root->url() . DIRECTORY_SEPARATOR . Config::CONFIG_DIR,
|
||||||
$this->root->url() . DIRECTORY_SEPARATOR . Config::STATIC_DIR
|
$this->root->url() . DIRECTORY_SEPARATOR . Config::STATIC_DIR
|
||||||
);
|
);
|
||||||
$configCache = new Cache();
|
$configCache = new Cache();
|
||||||
|
|
||||||
$configFileLoader->setupCache($configCache);
|
$configFileLoader->setupCache($configCache);
|
||||||
|
|
||||||
|
@ -299,7 +299,7 @@ class ConfigFileManagerTest extends MockedTestCase
|
||||||
$this->root->url() . DIRECTORY_SEPARATOR . Config::CONFIG_DIR,
|
$this->root->url() . DIRECTORY_SEPARATOR . Config::CONFIG_DIR,
|
||||||
$this->root->url() . DIRECTORY_SEPARATOR . Config::STATIC_DIR
|
$this->root->url() . DIRECTORY_SEPARATOR . Config::STATIC_DIR
|
||||||
);
|
);
|
||||||
$configCache = new Cache();
|
$configCache = new Cache();
|
||||||
|
|
||||||
$configFileLoader->setupCache($configCache);
|
$configFileLoader->setupCache($configCache);
|
||||||
|
|
||||||
|
@ -355,7 +355,7 @@ class ConfigFileManagerTest extends MockedTestCase
|
||||||
$this->root->url() . '/addon',
|
$this->root->url() . '/addon',
|
||||||
['FRIENDICA_CONFIG_DIR' => '/a/wrong/dir/'],
|
['FRIENDICA_CONFIG_DIR' => '/a/wrong/dir/'],
|
||||||
);
|
);
|
||||||
$configCache = new Cache();
|
$configCache = new Cache();
|
||||||
|
|
||||||
$configFileManager->setupCache($configCache);
|
$configFileManager->setupCache($configCache);
|
||||||
|
|
||||||
|
@ -385,7 +385,7 @@ class ConfigFileManagerTest extends MockedTestCase
|
||||||
$this->root->url() . '/addon',
|
$this->root->url() . '/addon',
|
||||||
['FRIENDICA_CONFIG_DIR' => $this->root->getChild('config2')->url()],
|
['FRIENDICA_CONFIG_DIR' => $this->root->getChild('config2')->url()],
|
||||||
);
|
);
|
||||||
$configCache = new Cache();
|
$configCache = new Cache();
|
||||||
|
|
||||||
$configFileManager->setupCache($configCache);
|
$configFileManager->setupCache($configCache);
|
||||||
|
|
||||||
|
@ -407,7 +407,7 @@ class ConfigFileManagerTest extends MockedTestCase
|
||||||
$this->root->url(),
|
$this->root->url(),
|
||||||
$this->root->url() . '/addon',
|
$this->root->url() . '/addon',
|
||||||
);
|
);
|
||||||
$configCache = new Cache();
|
$configCache = new Cache();
|
||||||
|
|
||||||
$configFileManager->setupCache($configCache);
|
$configFileManager->setupCache($configCache);
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,7 +16,6 @@ use Friendica\Core\Config\ValueObject\Cache;
|
||||||
use Friendica\Test\DatabaseTestCase;
|
use Friendica\Test\DatabaseTestCase;
|
||||||
use Friendica\Test\Util\CreateDatabaseTrait;
|
use Friendica\Test\Util\CreateDatabaseTrait;
|
||||||
use Friendica\Test\Util\VFSTrait;
|
use Friendica\Test\Util\VFSTrait;
|
||||||
use org\bovigo\vfs\vfsStream;
|
|
||||||
|
|
||||||
class ConfigTest extends DatabaseTestCase
|
class ConfigTest extends DatabaseTestCase
|
||||||
{
|
{
|
||||||
|
@ -55,7 +54,7 @@ class ConfigTest extends DatabaseTestCase
|
||||||
|
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
|
|
||||||
$this->configCache = new Cache();
|
$this->configCache = new Cache();
|
||||||
$this->configFileManager = new ConfigFileManager(
|
$this->configFileManager = new ConfigFileManager(
|
||||||
$this->root->url(),
|
$this->root->url(),
|
||||||
$this->root->url() . '/addon',
|
$this->root->url() . '/addon',
|
||||||
|
@ -99,7 +98,7 @@ class ConfigTest extends DatabaseTestCase
|
||||||
'key1' => 'value1a',
|
'key1' => 'value1a',
|
||||||
'key4' => 'value4',
|
'key4' => 'value4',
|
||||||
],
|
],
|
||||||
'other' => [
|
'other' => [
|
||||||
'key5' => 'value5',
|
'key5' => 'value5',
|
||||||
'key6' => 'value6',
|
'key6' => 'value6',
|
||||||
],
|
],
|
||||||
|
@ -113,18 +112,18 @@ class ConfigTest extends DatabaseTestCase
|
||||||
'config',
|
'config',
|
||||||
'other'
|
'other'
|
||||||
],
|
],
|
||||||
'load' => [
|
'load' => [
|
||||||
'system',
|
'system',
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
'other' => [
|
'other' => [
|
||||||
'data' => $data,
|
'data' => $data,
|
||||||
'possibleCats' => [
|
'possibleCats' => [
|
||||||
'system',
|
'system',
|
||||||
'config',
|
'config',
|
||||||
'other'
|
'other'
|
||||||
],
|
],
|
||||||
'load' => [
|
'load' => [
|
||||||
'other',
|
'other',
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
|
@ -135,18 +134,18 @@ class ConfigTest extends DatabaseTestCase
|
||||||
'config',
|
'config',
|
||||||
'other'
|
'other'
|
||||||
],
|
],
|
||||||
'load' => [
|
'load' => [
|
||||||
'config',
|
'config',
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
'all' => [
|
'all' => [
|
||||||
'data' => $data,
|
'data' => $data,
|
||||||
'possibleCats' => [
|
'possibleCats' => [
|
||||||
'system',
|
'system',
|
||||||
'config',
|
'config',
|
||||||
'other'
|
'other'
|
||||||
],
|
],
|
||||||
'load' => [
|
'load' => [
|
||||||
'system',
|
'system',
|
||||||
'config',
|
'config',
|
||||||
'other'
|
'other'
|
||||||
|
@ -178,7 +177,7 @@ class ConfigTest extends DatabaseTestCase
|
||||||
*/
|
*/
|
||||||
public function testSetUp(array $data)
|
public function testSetUp(array $data)
|
||||||
{
|
{
|
||||||
$this->loadDirectFixture($this->configToDbArray($data) , $this->getDbInstance());
|
$this->loadDirectFixture($this->configToDbArray($data), $this->getDbInstance());
|
||||||
|
|
||||||
$this->testedConfig = $this->getInstance();
|
$this->testedConfig = $this->getInstance();
|
||||||
self::assertInstanceOf(Cache::class, $this->testedConfig->getCache());
|
self::assertInstanceOf(Cache::class, $this->testedConfig->getCache());
|
||||||
|
@ -214,13 +213,13 @@ class ConfigTest extends DatabaseTestCase
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'config' => [
|
'config' => [
|
||||||
'data1' => [
|
'data1' => [
|
||||||
'config' => [
|
'config' => [
|
||||||
'key1' => 'value1',
|
'key1' => 'value1',
|
||||||
'key2' => 'value2',
|
'key2' => 'value2',
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
'data2' => [
|
'data2' => [
|
||||||
'config' => [
|
'config' => [
|
||||||
'key1' => 'overwritten!',
|
'key1' => 'overwritten!',
|
||||||
'key3' => 'value3',
|
'key3' => 'value3',
|
||||||
|
@ -235,19 +234,19 @@ class ConfigTest extends DatabaseTestCase
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
'other' => [
|
'other' => [
|
||||||
'data1' => [
|
'data1' => [
|
||||||
'config' => [
|
'config' => [
|
||||||
'key12' => 'data4',
|
'key12' => 'data4',
|
||||||
'key45' => 7,
|
'key45' => 7,
|
||||||
],
|
],
|
||||||
'other' => [
|
'other' => [
|
||||||
'key1' => 'value1',
|
'key1' => 'value1',
|
||||||
'key2' => 'value2',
|
'key2' => 'value2',
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
'data2' => [
|
'data2' => [
|
||||||
'other' => [
|
'other' => [
|
||||||
'key1' => 'overwritten!',
|
'key1' => 'overwritten!',
|
||||||
'key3' => 'value3',
|
'key3' => 'value3',
|
||||||
],
|
],
|
||||||
|
@ -257,7 +256,7 @@ class ConfigTest extends DatabaseTestCase
|
||||||
]
|
]
|
||||||
],
|
],
|
||||||
'expect' => [
|
'expect' => [
|
||||||
'other' => [
|
'other' => [
|
||||||
// load should overwrite values everytime!
|
// load should overwrite values everytime!
|
||||||
'key1' => 'overwritten!',
|
'key1' => 'overwritten!',
|
||||||
'key2' => 'value2',
|
'key2' => 'value2',
|
||||||
|
@ -404,26 +403,26 @@ class ConfigTest extends DatabaseTestCase
|
||||||
public function dataTestCat()
|
public function dataTestCat()
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'test_with_hashmap' => [
|
'test_with_hashmap' => [
|
||||||
'data' => [
|
'data' => [
|
||||||
'test_with_hashmap' => [
|
'test_with_hashmap' => [
|
||||||
'notifyall' => [
|
'notifyall' => [
|
||||||
'last_update' => 1671051565,
|
'last_update' => 1671051565,
|
||||||
'admin' => true,
|
'admin' => true,
|
||||||
],
|
],
|
||||||
'blockbot' => [
|
'blockbot' => [
|
||||||
'last_update' => 1658952852,
|
'last_update' => 1658952852,
|
||||||
'admin' => true,
|
'admin' => true,
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
'config' => [
|
'config' => [
|
||||||
'register_policy' => 2,
|
'register_policy' => 2,
|
||||||
'register_text' => '',
|
'register_text' => '',
|
||||||
'sitename' => 'Friendica Social Network23',
|
'sitename' => 'Friendica Social Network23',
|
||||||
'hostname' => 'friendica.local',
|
'hostname' => 'friendica.local',
|
||||||
'private_addons' => false,
|
'private_addons' => false,
|
||||||
],
|
],
|
||||||
'system' => [
|
'system' => [
|
||||||
'dbclean_expire_conversation' => 90,
|
'dbclean_expire_conversation' => 90,
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
|
@ -433,14 +432,14 @@ class ConfigTest extends DatabaseTestCase
|
||||||
'last_update' => 1671051565,
|
'last_update' => 1671051565,
|
||||||
'admin' => true,
|
'admin' => true,
|
||||||
],
|
],
|
||||||
'blockbot' => [
|
'blockbot' => [
|
||||||
'last_update' => 1658952852,
|
'last_update' => 1658952852,
|
||||||
'admin' => true,
|
'admin' => true,
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
'test_with_keys' => [
|
'test_with_keys' => [
|
||||||
'data' => [
|
'data' => [
|
||||||
'test_with_keys' => [
|
'test_with_keys' => [
|
||||||
[
|
[
|
||||||
'last_update' => 1671051565,
|
'last_update' => 1671051565,
|
||||||
|
@ -451,14 +450,14 @@ class ConfigTest extends DatabaseTestCase
|
||||||
'admin' => true,
|
'admin' => true,
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
'config' => [
|
'config' => [
|
||||||
'register_policy' => 2,
|
'register_policy' => 2,
|
||||||
'register_text' => '',
|
'register_text' => '',
|
||||||
'sitename' => 'Friendica Social Network23',
|
'sitename' => 'Friendica Social Network23',
|
||||||
'hostname' => 'friendica.local',
|
'hostname' => 'friendica.local',
|
||||||
'private_addons' => false,
|
'private_addons' => false,
|
||||||
],
|
],
|
||||||
'system' => [
|
'system' => [
|
||||||
'dbclean_expire_conversation' => 90,
|
'dbclean_expire_conversation' => 90,
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
|
@ -475,7 +474,7 @@ class ConfigTest extends DatabaseTestCase
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
'test_with_inner_array' => [
|
'test_with_inner_array' => [
|
||||||
'data' => [
|
'data' => [
|
||||||
'test_with_inner_array' => [
|
'test_with_inner_array' => [
|
||||||
'notifyall' => [
|
'notifyall' => [
|
||||||
'last_update' => 1671051565,
|
'last_update' => 1671051565,
|
||||||
|
@ -484,19 +483,19 @@ class ConfigTest extends DatabaseTestCase
|
||||||
'no' => 1.5,
|
'no' => 1.5,
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
'blogbot' => [
|
'blogbot' => [
|
||||||
'last_update' => 1658952852,
|
'last_update' => 1658952852,
|
||||||
'admin' => true,
|
'admin' => true,
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
'config' => [
|
'config' => [
|
||||||
'register_policy' => 2,
|
'register_policy' => 2,
|
||||||
'register_text' => '',
|
'register_text' => '',
|
||||||
'sitename' => 'Friendica Social Network23',
|
'sitename' => 'Friendica Social Network23',
|
||||||
'hostname' => 'friendica.local',
|
'hostname' => 'friendica.local',
|
||||||
'private_addons' => false,
|
'private_addons' => false,
|
||||||
],
|
],
|
||||||
'system' => [
|
'system' => [
|
||||||
'dbclean_expire_conversation' => 90,
|
'dbclean_expire_conversation' => 90,
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
|
@ -509,7 +508,7 @@ class ConfigTest extends DatabaseTestCase
|
||||||
'no' => 1.5,
|
'no' => 1.5,
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
'blogbot' => [
|
'blogbot' => [
|
||||||
'last_update' => 1658952852,
|
'last_update' => 1658952852,
|
||||||
'admin' => true,
|
'admin' => true,
|
||||||
],
|
],
|
||||||
|
@ -524,7 +523,7 @@ class ConfigTest extends DatabaseTestCase
|
||||||
public function testGetCategory(array $data, string $category, array $assertion)
|
public function testGetCategory(array $data, string $category, array $assertion)
|
||||||
{
|
{
|
||||||
$this->configCache = new Cache($data);
|
$this->configCache = new Cache($data);
|
||||||
$config = new ReadOnlyFileConfig($this->configCache);
|
$config = new ReadOnlyFileConfig($this->configCache);
|
||||||
|
|
||||||
self::assertEquals($assertion, $config->get($category));
|
self::assertEquals($assertion, $config->get($category));
|
||||||
}
|
}
|
||||||
|
@ -533,15 +532,15 @@ class ConfigTest extends DatabaseTestCase
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'default' => [
|
'default' => [
|
||||||
'value' => ['test' => ['array']],
|
'value' => ['test' => ['array']],
|
||||||
'assertion' => ['test' => ['array']],
|
'assertion' => ['test' => ['array']],
|
||||||
],
|
],
|
||||||
'issue-12803' => [
|
'issue-12803' => [
|
||||||
'value' => 's:48:"s:40:"s:32:"https://punkrock-underground.com";";";',
|
'value' => 's:48:"s:40:"s:32:"https://punkrock-underground.com";";";',
|
||||||
'assertion' => 'https://punkrock-underground.com',
|
'assertion' => 'https://punkrock-underground.com',
|
||||||
],
|
],
|
||||||
'double-serialized-array' => [
|
'double-serialized-array' => [
|
||||||
'value' => 's:53:"a:1:{s:9:"testArray";a:1:{s:4:"with";s:7:"entries";}}";',
|
'value' => 's:53:"a:1:{s:9:"testArray";a:1:{s:4:"with";s:7:"entries";}}";',
|
||||||
'assertion' => ['testArray' => ['with' => 'entries']],
|
'assertion' => ['testArray' => ['with' => 'entries']],
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
|
@ -563,33 +562,33 @@ class ConfigTest extends DatabaseTestCase
|
||||||
$data = [
|
$data = [
|
||||||
'config' => [
|
'config' => [
|
||||||
'admin_email' => 'value1',
|
'admin_email' => 'value1',
|
||||||
'timezone' => 'value2',
|
'timezone' => 'value2',
|
||||||
'language' => 'value3',
|
'language' => 'value3',
|
||||||
'sitename' => 'value',
|
'sitename' => 'value',
|
||||||
],
|
],
|
||||||
'system' => [
|
'system' => [
|
||||||
'url' => 'value1a',
|
'url' => 'value1a',
|
||||||
'debugging' => true,
|
'debugging' => true,
|
||||||
'logfile' => 'value4',
|
'logfile' => 'value4',
|
||||||
'loglevel' => 'notice',
|
'loglevel' => 'notice',
|
||||||
'proflier' => true,
|
'proflier' => true,
|
||||||
],
|
],
|
||||||
'proxy' => [
|
'proxy' => [
|
||||||
'trusted_proxies' => 'value5',
|
'trusted_proxies' => 'value5',
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
|
|
||||||
return [
|
return [
|
||||||
'empty' => [
|
'empty' => [
|
||||||
'data' => $data,
|
'data' => $data,
|
||||||
'server' => [],
|
'server' => [],
|
||||||
'assertDisabled' => [],
|
'assertDisabled' => [],
|
||||||
],
|
],
|
||||||
'mixed' => [
|
'mixed' => [
|
||||||
'data' => $data,
|
'data' => $data,
|
||||||
'server' => [
|
'server' => [
|
||||||
'FRIENDICA_ADMIN_MAIL' => 'test@friendica.local',
|
'FRIENDICA_ADMIN_MAIL' => 'test@friendica.local',
|
||||||
'FRIENDICA_DEBUGGING' => true,
|
'FRIENDICA_DEBUGGING' => true,
|
||||||
],
|
],
|
||||||
'assertDisabled' => [
|
'assertDisabled' => [
|
||||||
'config' => [
|
'config' => [
|
||||||
|
|
|
@ -9,16 +9,11 @@ namespace Friendica\Test\src\Core\Config;
|
||||||
|
|
||||||
use Friendica\Core\Config\Capability\ISetConfigValuesTransactionally;
|
use Friendica\Core\Config\Capability\ISetConfigValuesTransactionally;
|
||||||
use Friendica\Core\Config\Model\DatabaseConfig;
|
use Friendica\Core\Config\Model\DatabaseConfig;
|
||||||
use Friendica\Core\Config\Model\ReadOnlyFileConfig;
|
|
||||||
use Friendica\Core\Config\Model\ConfigTransaction;
|
use Friendica\Core\Config\Model\ConfigTransaction;
|
||||||
use Friendica\Core\Config\Util\ConfigFileManager;
|
use Friendica\Core\Config\Util\ConfigFileManager;
|
||||||
use Friendica\Core\Config\ValueObject\Cache;
|
use Friendica\Core\Config\ValueObject\Cache;
|
||||||
use Friendica\Database\Database;
|
use Friendica\Database\Database;
|
||||||
use Friendica\Test\DatabaseTestCase;
|
|
||||||
use Friendica\Test\FixtureTestCase;
|
use Friendica\Test\FixtureTestCase;
|
||||||
use Friendica\Test\MockedTest;
|
|
||||||
use Friendica\Test\Util\Database\StaticDatabase;
|
|
||||||
use Friendica\Test\Util\VFSTrait;
|
|
||||||
use Mockery\Exception\InvalidCountException;
|
use Mockery\Exception\InvalidCountException;
|
||||||
|
|
||||||
class ConfigTransactionTest extends FixtureTestCase
|
class ConfigTransactionTest extends FixtureTestCase
|
||||||
|
@ -101,7 +96,7 @@ class ConfigTransactionTest extends FixtureTestCase
|
||||||
{
|
{
|
||||||
$this->configFileManager = \Mockery::spy(ConfigFileManager::class);
|
$this->configFileManager = \Mockery::spy(ConfigFileManager::class);
|
||||||
|
|
||||||
$config = new DatabaseConfig($this->dice->create(Database::class), new Cache());
|
$config = new DatabaseConfig($this->dice->create(Database::class), new Cache());
|
||||||
$configTransaction = new ConfigTransaction($config);
|
$configTransaction = new ConfigTransaction($config);
|
||||||
|
|
||||||
// commit empty transaction
|
// commit empty transaction
|
||||||
|
|
|
@ -21,16 +21,12 @@ use Friendica\Core\Storage\Repository\StorageManager;
|
||||||
use Friendica\Core\Storage\Type\Filesystem;
|
use Friendica\Core\Storage\Type\Filesystem;
|
||||||
use Friendica\Core\Storage\Type\SystemResource;
|
use Friendica\Core\Storage\Type\SystemResource;
|
||||||
use Friendica\Database\Database;
|
use Friendica\Database\Database;
|
||||||
use Friendica\Database\Definition\DbaDefinition;
|
|
||||||
use Friendica\Database\Definition\ViewDefinition;
|
|
||||||
use Friendica\DI;
|
use Friendica\DI;
|
||||||
use Friendica\Core\Config\Factory\Config;
|
use Friendica\Core\Config\Factory\Config;
|
||||||
use Friendica\Core\Storage\Type;
|
use Friendica\Core\Storage\Type;
|
||||||
use Friendica\Test\DatabaseTestCase;
|
use Friendica\Test\DatabaseTestCase;
|
||||||
use Friendica\Test\Util\CreateDatabaseTrait;
|
use Friendica\Test\Util\CreateDatabaseTrait;
|
||||||
use Friendica\Test\Util\Database\StaticDatabase;
|
use Friendica\Test\Util\Database\StaticDatabase;
|
||||||
use Friendica\Test\Util\VFSTrait;
|
|
||||||
use Friendica\Util\Profiler;
|
|
||||||
use org\bovigo\vfs\vfsStream;
|
use org\bovigo\vfs\vfsStream;
|
||||||
use Psr\Log\LoggerInterface;
|
use Psr\Log\LoggerInterface;
|
||||||
use Psr\Log\NullLogger;
|
use Psr\Log\NullLogger;
|
||||||
|
@ -60,7 +56,7 @@ class StorageManagerTest extends DatabaseTestCase
|
||||||
|
|
||||||
vfsStream::newDirectory(Type\FilesystemConfig::DEFAULT_BASE_FOLDER, 0777)->at($this->root);
|
vfsStream::newDirectory(Type\FilesystemConfig::DEFAULT_BASE_FOLDER, 0777)->at($this->root);
|
||||||
|
|
||||||
$this->logger = new NullLogger();
|
$this->logger = new NullLogger();
|
||||||
$this->database = $this->getDbInstance();
|
$this->database = $this->getDbInstance();
|
||||||
|
|
||||||
$configFactory = new Config();
|
$configFactory = new Config();
|
||||||
|
@ -68,7 +64,7 @@ class StorageManagerTest extends DatabaseTestCase
|
||||||
$this->root->url(),
|
$this->root->url(),
|
||||||
$this->root->url() . '/addon',
|
$this->root->url() . '/addon',
|
||||||
);
|
);
|
||||||
$configCache = $configFactory->createCache($configFileManager);
|
$configCache = $configFactory->createCache($configFileManager);
|
||||||
|
|
||||||
$this->config = new \Friendica\Core\Config\Model\DatabaseConfig($this->database, $configCache);
|
$this->config = new \Friendica\Core\Config\Model\DatabaseConfig($this->database, $configCache);
|
||||||
$this->config->set('storage', 'name', 'Database');
|
$this->config->set('storage', 'name', 'Database');
|
||||||
|
@ -99,21 +95,21 @@ class StorageManagerTest extends DatabaseTestCase
|
||||||
public function dataStorages()
|
public function dataStorages()
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'empty' => [
|
'empty' => [
|
||||||
'name' => '',
|
'name' => '',
|
||||||
'valid' => false,
|
'valid' => false,
|
||||||
'interface' => ICanReadFromStorage::class,
|
'interface' => ICanReadFromStorage::class,
|
||||||
'assert' => null,
|
'assert' => null,
|
||||||
'assertName' => '',
|
'assertName' => '',
|
||||||
],
|
],
|
||||||
'database' => [
|
'database' => [
|
||||||
'name' => Type\Database::NAME,
|
'name' => Type\Database::NAME,
|
||||||
'valid' => true,
|
'valid' => true,
|
||||||
'interface' => ICanWriteToStorage::class,
|
'interface' => ICanWriteToStorage::class,
|
||||||
'assert' => Type\Database::class,
|
'assert' => Type\Database::class,
|
||||||
'assertName' => Type\Database::NAME,
|
'assertName' => Type\Database::NAME,
|
||||||
],
|
],
|
||||||
'filesystem' => [
|
'filesystem' => [
|
||||||
'name' => Filesystem::NAME,
|
'name' => Filesystem::NAME,
|
||||||
'valid' => true,
|
'valid' => true,
|
||||||
'interface' => ICanWriteToStorage::class,
|
'interface' => ICanWriteToStorage::class,
|
||||||
|
@ -127,7 +123,7 @@ class StorageManagerTest extends DatabaseTestCase
|
||||||
'assert' => SystemResource::class,
|
'assert' => SystemResource::class,
|
||||||
'assertName' => SystemResource::NAME,
|
'assertName' => SystemResource::NAME,
|
||||||
],
|
],
|
||||||
'invalid' => [
|
'invalid' => [
|
||||||
'name' => 'invalid',
|
'name' => 'invalid',
|
||||||
'valid' => false,
|
'valid' => false,
|
||||||
'interface' => null,
|
'interface' => null,
|
||||||
|
|
|
@ -92,7 +92,7 @@ class DatabaseTest extends FixtureTestCase
|
||||||
|
|
||||||
self::assertTrue($db->update('gserver', ['active-week-users' => 0, 'registered-users' => 0], ['nurl' => 'http://friendica.local']));
|
self::assertTrue($db->update('gserver', ['active-week-users' => 0, 'registered-users' => 0], ['nurl' => 'http://friendica.local']));
|
||||||
|
|
||||||
$fields = ["`registered-users` = `registered-users` + 1"];
|
$fields = ["`registered-users` = `registered-users` + 1"];
|
||||||
$fields[] = "`active-week-users` = `active-week-users` + 2";
|
$fields[] = "`active-week-users` = `active-week-users` + 2";
|
||||||
|
|
||||||
self::assertTrue($db->update('gserver', $fields, ['nurl' => 'http://friendica.local']));
|
self::assertTrue($db->update('gserver', $fields, ['nurl' => 'http://friendica.local']));
|
||||||
|
|
Loading…
Add table
Reference in a new issue