summaryrefslogtreecommitdiffstats
path: root/tests/lib/Files/ObjectStore/ObjectStoreStorageTest.php
diff options
context:
space:
mode:
Diffstat (limited to 'tests/lib/Files/ObjectStore/ObjectStoreStorageTest.php')
-rw-r--r--tests/lib/Files/ObjectStore/ObjectStoreStorageTest.php17
1 files changed, 16 insertions, 1 deletions
diff --git a/tests/lib/Files/ObjectStore/ObjectStoreStorageTest.php b/tests/lib/Files/ObjectStore/ObjectStoreStorageTest.php
index c9d6c1bd922..3b3827f460a 100644
--- a/tests/lib/Files/ObjectStore/ObjectStoreStorageTest.php
+++ b/tests/lib/Files/ObjectStore/ObjectStoreStorageTest.php
@@ -30,6 +30,8 @@ use Test\Files\Storage\Storage;
* @group DB
*/
class ObjectStoreStorageTest extends Storage {
+ /** @var ObjectStoreStorageOverwrite */
+ protected $instance;
/**
* @var IObjectStore
@@ -42,7 +44,7 @@ class ObjectStoreStorageTest extends Storage {
$baseStorage = new Temporary();
$this->objectStorage = new StorageObjectStore($baseStorage);
$config['objectstore'] = $this->objectStorage;
- $this->instance = new ObjectStoreStorage($config);
+ $this->instance = new ObjectStoreStorageOverwrite($config);
}
protected function tearDown() {
@@ -166,4 +168,17 @@ class ObjectStoreStorageTest extends Storage {
$targetId = $this->instance->getCache()->getId('target');
$this->assertSame($sourceId, $targetId, 'fileid must be stable on move or shares will break');
}
+
+ public function testWriteObjectSilentFailure() {
+ $objectStore = $this->instance->getObjectStore();
+ $this->instance->setObjectStore(new FailWriteObjectStore($objectStore));
+
+ try {
+ $this->instance->file_put_contents('test.txt', 'foo');
+ $this->fail('expected exception');
+ } catch (\Exception $e) {
+ $this->assertStringStartsWith('Object not found after writing', $e->getMessage());
+ }
+ $this->assertFalse($this->instance->file_exists('test.txt'));
+ }
}