diff options
author | Roeland Jago Douma <rullzer@users.noreply.github.com> | 2020-11-25 16:09:26 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-11-25 16:09:26 +0100 |
commit | 2172432420a85abdd3f4acbc223fff4ef30d3d64 (patch) | |
tree | e393c9e1c785cbcf198463c4418ce82c0a51ea38 /tests/lib | |
parent | e165dcbe35b68ddfab5ad07d5271c869a890825b (diff) | |
parent | 9d4848e86383afd1ec49aa81f606f2042def2133 (diff) | |
download | nextcloud-server-2172432420a85abdd3f4acbc223fff4ef30d3d64.tar.gz nextcloud-server-2172432420a85abdd3f4acbc223fff4ef30d3d64.zip |
Merge pull request #23912 from nextcloud/objectstore-copy
use in objectstore copy
Diffstat (limited to 'tests/lib')
-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'))); + } } |