Cleanup namespaces
This commit is contained in:
parent
7c38647573
commit
d778af0b0e
|
@ -40,7 +40,7 @@ class Storage extends BaseAdmin
|
||||||
$storagebackend = Strings::escapeTags(trim($parameters['name'] ?? ''));
|
$storagebackend = Strings::escapeTags(trim($parameters['name'] ?? ''));
|
||||||
|
|
||||||
try {
|
try {
|
||||||
/** @var \Friendica\Core\Storage\Capability\ICanConfigureStorage|false $newStorageConfig */
|
/** @var ICanConfigureStorage|false $newStorageConfig */
|
||||||
$newStorageConfig = DI::storageManager()->getConfigurationByName($storagebackend);
|
$newStorageConfig = DI::storageManager()->getConfigurationByName($storagebackend);
|
||||||
} catch (InvalidClassStorageException $storageException) {
|
} catch (InvalidClassStorageException $storageException) {
|
||||||
notice(DI::l10n()->t('Storage backend, %s is invalid.', $storagebackend));
|
notice(DI::l10n()->t('Storage backend, %s is invalid.', $storagebackend));
|
||||||
|
@ -78,7 +78,6 @@ class Storage extends BaseAdmin
|
||||||
|
|
||||||
if (!empty($_POST['submit_save_set'])) {
|
if (!empty($_POST['submit_save_set'])) {
|
||||||
try {
|
try {
|
||||||
/** @var \Friendica\Core\Storage\Capability\ICanWriteToStorage $newstorage */
|
|
||||||
$newstorage = DI::storageManager()->getWritableStorageByName($storagebackend);
|
$newstorage = DI::storageManager()->getWritableStorageByName($storagebackend);
|
||||||
|
|
||||||
if (!DI::storageManager()->setBackend($newstorage)) {
|
if (!DI::storageManager()->setBackend($newstorage)) {
|
||||||
|
|
|
@ -31,6 +31,7 @@ use Friendica\Core\Session\Type\Memory;
|
||||||
use Friendica\Core\Storage\Exception\InvalidClassStorageException;
|
use Friendica\Core\Storage\Exception\InvalidClassStorageException;
|
||||||
use Friendica\Core\Storage\Capability\ICanReadFromStorage;
|
use Friendica\Core\Storage\Capability\ICanReadFromStorage;
|
||||||
use Friendica\Core\Storage\Capability\ICanWriteToStorage;
|
use Friendica\Core\Storage\Capability\ICanWriteToStorage;
|
||||||
|
use Friendica\Core\Storage\Exception\StorageException;
|
||||||
use Friendica\Core\Storage\Repository\StorageManager;
|
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;
|
||||||
|
@ -257,7 +258,7 @@ class StorageManagerTest extends DatabaseTest
|
||||||
$dice = (new Dice())
|
$dice = (new Dice())
|
||||||
->addRules(include __DIR__ . '/../../../../../static/dependencies.config.php')
|
->addRules(include __DIR__ . '/../../../../../static/dependencies.config.php')
|
||||||
->addRule(Database::class, ['instanceOf' => StaticDatabase::class, 'shared' => true])
|
->addRule(Database::class, ['instanceOf' => StaticDatabase::class, 'shared' => true])
|
||||||
->addRule(IHandleSessions::class, ['instanceOf' => Session\Type\Memory::class, 'shared' => true, 'call' => null]);
|
->addRule(IHandleSessions::class, ['instanceOf' => Memory::class, 'shared' => true, 'call' => null]);
|
||||||
DI::init($dice);
|
DI::init($dice);
|
||||||
|
|
||||||
$storageManager = new StorageManager($this->dba, $this->config, $this->logger, $this->l10n);
|
$storageManager = new StorageManager($this->dba, $this->config, $this->logger, $this->l10n);
|
||||||
|
@ -308,7 +309,7 @@ class StorageManagerTest extends DatabaseTest
|
||||||
|
|
||||||
self::assertInstanceOf(SampleStorageBackend::class, $storageManager->getBackend());
|
self::assertInstanceOf(SampleStorageBackend::class, $storageManager->getBackend());
|
||||||
|
|
||||||
self::expectException(\Friendica\Core\Storage\Exception\StorageException::class);
|
self::expectException(StorageException::class);
|
||||||
self::expectExceptionMessage('Cannot unregister Sample Storage, because it\'s currently active.');
|
self::expectExceptionMessage('Cannot unregister Sample Storage, because it\'s currently active.');
|
||||||
|
|
||||||
$storageManager->unregister(SampleStorageBackend::class);
|
$storageManager->unregister(SampleStorageBackend::class);
|
||||||
|
|
|
@ -26,10 +26,10 @@ use Friendica\Test\MockedTest;
|
||||||
|
|
||||||
abstract class StorageConfigTest extends MockedTest
|
abstract class StorageConfigTest extends MockedTest
|
||||||
{
|
{
|
||||||
/** @return \Friendica\Core\Storage\Capability\ICanConfigureStorage */
|
/** @return ICanConfigureStorage */
|
||||||
abstract protected function getInstance();
|
abstract protected function getInstance();
|
||||||
|
|
||||||
abstract protected function assertOption(\Friendica\Core\Storage\Capability\ICanConfigureStorage $storage);
|
abstract protected function assertOption(ICanConfigureStorage $storage);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test if the "getOption" is asserted
|
* Test if the "getOption" is asserted
|
||||||
|
|
Loading…
Reference in New Issue
Block a user