Fix Storage Exceptions

This commit is contained in:
Philipp 2021-08-01 14:31:57 +02:00
parent 29c7552df5
commit 90c99520bb
No known key found for this signature in database
GPG key ID: 9A28B7D4FF5667BD
6 changed files with 46 additions and 35 deletions

View file

@ -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);
}
/**