summaryrefslogtreecommitdiffstats
path: root/tests/lib
diff options
context:
space:
mode:
authorRoeland Jago Douma <rullzer@users.noreply.github.com>2020-11-25 16:09:26 +0100
committerGitHub <noreply@github.com>2020-11-25 16:09:26 +0100
commit2172432420a85abdd3f4acbc223fff4ef30d3d64 (patch)
treee393c9e1c785cbcf198463c4418ce82c0a51ea38 /tests/lib
parente165dcbe35b68ddfab5ad07d5271c869a890825b (diff)
parent9d4848e86383afd1ec49aa81f606f2042def2133 (diff)
downloadnextcloud-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.php4
-rw-r--r--tests/lib/Files/ObjectStore/FailWriteObjectStore.php4
-rw-r--r--tests/lib/Files/ObjectStore/ObjectStoreTest.php16
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')));
+ }
}