diff options
author | Robin Appelman <robin@icewind.nl> | 2020-11-05 16:30:05 +0100 |
---|---|---|
committer | Robin Appelman <robin@icewind.nl> | 2020-11-24 15:16:58 +0100 |
commit | 9d4848e86383afd1ec49aa81f606f2042def2133 (patch) | |
tree | 164177856713c1b64fa303bd87a7d03da949291d /tests/lib/Files/ObjectStore | |
parent | f37155d28ba1bc805eeb3abd445d3d965ecb34bd (diff) | |
download | nextcloud-server-9d4848e86383afd1ec49aa81f606f2042def2133.tar.gz nextcloud-server-9d4848e86383afd1ec49aa81f606f2042def2133.zip |
use in objectstore copy
Signed-off-by: Robin Appelman <robin@icewind.nl>
Diffstat (limited to 'tests/lib/Files/ObjectStore')
-rw-r--r-- | tests/lib/Files/ObjectStore/FailDeleteObjectStore.php | 4 | ||||
-rw-r--r-- | tests/lib/Files/ObjectStore/FailWriteObjectStore.php | 4 | ||||
-rw-r--r-- | tests/lib/Files/ObjectStore/ObjectStoreTest.php | 16 |
3 files changed, 24 insertions, 0 deletions
diff --git a/tests/lib/Files/ObjectStore/FailDeleteObjectStore.php b/tests/lib/Files/ObjectStore/FailDeleteObjectStore.php index 1a3477090b9..c755657faff 100644 --- a/tests/lib/Files/ObjectStore/FailDeleteObjectStore.php +++ b/tests/lib/Files/ObjectStore/FailDeleteObjectStore.php @@ -51,4 +51,8 @@ class FailDeleteObjectStore implements IObjectStore { public function objectExists($urn) { return $this->objectStore->objectExists($urn); } + + public function copyObject($from, $to) { + $this->objectStore->copyObject($from, $to); + } } diff --git a/tests/lib/Files/ObjectStore/FailWriteObjectStore.php b/tests/lib/Files/ObjectStore/FailWriteObjectStore.php index ad2350ea36b..b9c8751fda3 100644 --- a/tests/lib/Files/ObjectStore/FailWriteObjectStore.php +++ b/tests/lib/Files/ObjectStore/FailWriteObjectStore.php @@ -52,4 +52,8 @@ class FailWriteObjectStore implements IObjectStore { public function objectExists($urn) { return $this->objectStore->objectExists($urn); } + + public function copyObject($from, $to) { + $this->objectStore->copyObject($from, $to); + } } diff --git a/tests/lib/Files/ObjectStore/ObjectStoreTest.php b/tests/lib/Files/ObjectStore/ObjectStoreTest.php index 9300a9bdef6..4ec44eb410d 100644 --- a/tests/lib/Files/ObjectStore/ObjectStoreTest.php +++ b/tests/lib/Files/ObjectStore/ObjectStoreTest.php @@ -108,4 +108,20 @@ abstract class ObjectStoreTest extends TestCase { $this->assertFalse($instance->objectExists('2')); } + + public function testCopy() { + $stream = $this->stringToStream('foobar'); + + $instance = $this->getInstance(); + + $instance->writeObject('source', $stream); + + $this->assertFalse($instance->objectExists('target')); + + $instance->copyObject('source', 'target'); + + $this->assertTrue($instance->objectExists('target')); + + $this->assertEquals('foobar', stream_get_contents($instance->readObject('target'))); + } } |