mirror of
https://github.com/friendica/friendica
synced 2025-04-25 11:10:11 +00:00
Fix Storage Exceptions
This commit is contained in:
parent
29c7552df5
commit
90c99520bb
6 changed files with 46 additions and 35 deletions
|
@ -62,10 +62,7 @@ class DatabaseStorageTest extends StorageTest
|
|||
|
||||
$dba = new StaticDatabase($configCache, $profiler, $logger);
|
||||
|
||||
/** @var MockInterface|L10n $l10n */
|
||||
$l10n = \Mockery::mock(L10n::class)->makePartial();
|
||||
|
||||
return new Database($dba, $logger, $l10n);
|
||||
return new Database($dba);
|
||||
}
|
||||
|
||||
protected function assertOption(IStorage $storage)
|
||||
|
|
|
@ -50,7 +50,6 @@ class FilesystemStorageTest extends StorageTest
|
|||
|
||||
protected function getInstance()
|
||||
{
|
||||
$logger = new NullLogger();
|
||||
$profiler = \Mockery::mock(Profiler::class);
|
||||
$profiler->shouldReceive('startRecording');
|
||||
$profiler->shouldReceive('stopRecording');
|
||||
|
@ -63,7 +62,7 @@ class FilesystemStorageTest extends StorageTest
|
|||
->with('storage', 'filesystem_path', Filesystem::DEFAULT_BASE_FOLDER)
|
||||
->andReturn($this->root->getChild('storage')->url());
|
||||
|
||||
return new Filesystem($this->config, $logger, $l10n);
|
||||
return new Filesystem($this->config, $l10n);
|
||||
}
|
||||
|
||||
protected function assertOption(IStorage $storage)
|
||||
|
|
|
@ -22,6 +22,8 @@
|
|||
namespace Friendica\Test\src\Model\Storage;
|
||||
|
||||
use Friendica\Model\Storage\IStorage;
|
||||
use Friendica\Model\Storage\ReferenceStorageException;
|
||||
use Friendica\Model\Storage\StorageException;
|
||||
use Friendica\Test\MockedTest;
|
||||
|
||||
abstract class StorageTest extends MockedTest
|
||||
|
@ -62,7 +64,7 @@ abstract class StorageTest extends MockedTest
|
|||
|
||||
self::assertEquals('data12345', $instance->get($ref));
|
||||
|
||||
self::assertTrue($instance->delete($ref));
|
||||
$instance->delete($ref);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -70,10 +72,11 @@ abstract class StorageTest extends MockedTest
|
|||
*/
|
||||
public function testInvalidDelete()
|
||||
{
|
||||
self::expectException(ReferenceStorageException::class);
|
||||
|
||||
$instance = $this->getInstance();
|
||||
|
||||
// Even deleting not existing references should return "true"
|
||||
self::assertTrue($instance->delete(-1234456));
|
||||
$instance->delete(-1234456);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -81,10 +84,11 @@ abstract class StorageTest extends MockedTest
|
|||
*/
|
||||
public function testInvalidGet()
|
||||
{
|
||||
self::expectException(ReferenceStorageException::class);
|
||||
|
||||
$instance = $this->getInstance();
|
||||
|
||||
// Invalid references return an empty string
|
||||
self::assertEmpty($instance->get(-123456));
|
||||
$instance->get(-123456);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue