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