Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorMorris Jobke <hey@morrisjobke.de>2021-01-07 15:28:38 +0300
committerGitHub <noreply@github.com>2021-01-07 15:28:38 +0300
commit57e165c244cda90f78ee59c293995ae9eeb5ce11 (patch)
tree60b11e2d64dc13b45632c98c19b283e9e4bab5b0 /tests
parent3f8024932a5e8fc7c0f5eecabb6a8d618a12f70c (diff)
parentdedff0facb10e27f5243b4e495a4e31ca7ec8456 (diff)
Merge pull request #24593 from nextcloud/backport/23912/stable19
[stable19] use in objectstore copy
Diffstat (limited to 'tests')
-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')));
+ }
}