summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorRobin Appelman <icewind@owncloud.com>2015-01-16 13:33:17 +0100
committerRobin Appelman <icewind@owncloud.com>2015-04-13 15:13:02 +0200
commit31e94708f86e21174e4bcfaf33f645dbba1efc1e (patch)
tree9aa5bedacd55deda348d64bcd1fbe0fe506416c3 /tests
parent8575bb2cb9f57d2b7e6d9e9e48e7c85485a7c63b (diff)
downloadnextcloud-server-31e94708f86e21174e4bcfaf33f645dbba1efc1e.tar.gz
nextcloud-server-31e94708f86e21174e4bcfaf33f645dbba1efc1e.zip
Improve cross storage copy between local storages
Diffstat (limited to 'tests')
-rw-r--r--tests/lib/files/view.php69
1 files changed, 67 insertions, 2 deletions
diff --git a/tests/lib/files/view.php b/tests/lib/files/view.php
index 2ea9e8de78f..3b5e3aa3b08 100644
--- a/tests/lib/files/view.php
+++ b/tests/lib/files/view.php
@@ -8,6 +8,7 @@
namespace Test\Files;
use OC\Files\Cache\Watcher;
+use OC\Files\Storage\Common;
use OC\Files\Mount\MountPoint;
use OC\Files\Storage\Temporary;
@@ -17,6 +18,26 @@ class TemporaryNoTouch extends \OC\Files\Storage\Temporary {
}
}
+class TemporaryNoCross extends \OC\Files\Storage\Temporary {
+ public function copyFromStorage(\OCP\Files\Storage $sourceStorage, $sourceInternalPath, $targetInternalPath) {
+ return Common::copyFromStorage($sourceStorage, $sourceInternalPath, $targetInternalPath);
+ }
+
+ public function moveFromStorage(\OCP\Files\Storage $sourceStorage, $sourceInternalPath, $targetInternalPath) {
+ return Common::moveFromStorage($sourceStorage, $sourceInternalPath, $targetInternalPath);
+ }
+}
+
+class TemporaryNoLocal extends \OC\Files\Storage\Temporary {
+ public function instanceOfStorage($className) {
+ if($className === '\OC\Files\Storage\Local') {
+ return false;
+ } else {
+ return parent::instanceOfStorage($className);
+ }
+ }
+}
+
class View extends \Test\TestCase {
/**
* @var \OC\Files\Storage\Storage[] $storages
@@ -291,9 +312,31 @@ class View extends \Test\TestCase {
/**
* @medium
*/
- function testCopyBetweenStorages() {
+ function testCopyBetweenStorageNoCross() {
+ $storage1 = $this->getTestStorage(true, '\Test\Files\TemporaryNoCross');
+ $storage2 = $this->getTestStorage(true, '\Test\Files\TemporaryNoCross');
+ $this->copyBetweenStorages($storage1, $storage2);
+ }
+
+ /**
+ * @medium
+ */
+ function testCopyBetweenStorageCross() {
$storage1 = $this->getTestStorage();
$storage2 = $this->getTestStorage();
+ $this->copyBetweenStorages($storage1, $storage2);
+ }
+
+ /**
+ * @medium
+ */
+ function testCopyBetweenStorageCrossNonLocal() {
+ $storage1 = $this->getTestStorage(true, '\Test\Files\TemporaryNoLocal');
+ $storage2 = $this->getTestStorage(true, '\Test\Files\TemporaryNoLocal');
+ $this->copyBetweenStorages($storage1, $storage2);
+ }
+
+ function copyBetweenStorages($storage1, $storage2) {
\OC\Files\Filesystem::mount($storage1, array(), '/');
\OC\Files\Filesystem::mount($storage2, array(), '/substorage');
@@ -315,9 +358,31 @@ class View extends \Test\TestCase {
/**
* @medium
*/
- function testMoveBetweenStorages() {
+ function testMoveBetweenStorageNoCross() {
+ $storage1 = $this->getTestStorage(true, '\Test\Files\TemporaryNoCross');
+ $storage2 = $this->getTestStorage(true, '\Test\Files\TemporaryNoCross');
+ $this->moveBetweenStorages($storage1, $storage2);
+ }
+
+ /**
+ * @medium
+ */
+ function testMoveBetweenStorageCross() {
$storage1 = $this->getTestStorage();
$storage2 = $this->getTestStorage();
+ $this->moveBetweenStorages($storage1, $storage2);
+ }
+
+ /**
+ * @medium
+ */
+ function testMoveBetweenStorageCrossNonLocal() {
+ $storage1 = $this->getTestStorage(true, '\Test\Files\TemporaryNoLocal');
+ $storage2 = $this->getTestStorage(true, '\Test\Files\TemporaryNoLocal');
+ $this->moveBetweenStorages($storage1, $storage2);
+ }
+
+ function moveBetweenStorages($storage1, $storage2) {
\OC\Files\Filesystem::mount($storage1, array(), '/');
\OC\Files\Filesystem::mount($storage2, array(), '/substorage');