summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorMichael Gapczynski <mtgap@owncloud.com>2013-05-19 14:20:46 -0400
committerMichael Gapczynski <mtgap@owncloud.com>2013-05-19 14:20:46 -0400
commite9b71eed691050e23d78910abdd8bf313f2f83cb (patch)
tree3ae5e62af3de306c27e62c0fb32bece0e3b4b74b /tests
parent41e2d64c86fffc3e507a1ad0788bcb498db2c640 (diff)
downloadnextcloud-server-e9b71eed691050e23d78910abdd8bf313f2f83cb.tar.gz
nextcloud-server-e9b71eed691050e23d78910abdd8bf313f2f83cb.zip
Add tests for copying/moving between storages
Diffstat (limited to 'tests')
-rw-r--r--tests/lib/files/view.php34
1 files changed, 34 insertions, 0 deletions
diff --git a/tests/lib/files/view.php b/tests/lib/files/view.php
index a064e44f3ef..554bc7291ad 100644
--- a/tests/lib/files/view.php
+++ b/tests/lib/files/view.php
@@ -228,6 +228,40 @@ class View extends \PHPUnit_Framework_TestCase {
$this->assertEquals(3, $cachedData['size']);
}
+ function testCopyBetweenStorages() {
+ $storage1 = $this->getTestStorage();
+ $storage2 = $this->getTestStorage();
+ \OC\Files\Filesystem::mount($storage1, array(), '/');
+ \OC\Files\Filesystem::mount($storage2, array(), '/substorage');
+
+ $rootView = new \OC\Files\View('');
+ $rootView->copy('substorage', 'anotherfolder');
+ $this->assertTrue($rootView->is_dir('/anotherfolder'));
+ $this->assertTrue($rootView->is_dir('/substorage'));
+ $this->assertTrue($rootView->file_exists('/anotherfolder/foo.txt'));
+ $this->assertTrue($rootView->file_exists('/anotherfolder/foo.png'));
+ $this->assertTrue($rootView->file_exists('/anotherfolder/folder/bar.txt'));
+ $this->assertTrue($rootView->file_exists('/substorage/foo.txt'));
+ $this->assertTrue($rootView->file_exists('/substorage/foo.png'));
+ $this->assertTrue($rootView->file_exists('/substorage/folder/bar.txt'));
+ }
+
+ function testMoveBetweenStorages() {
+ $storage1 = $this->getTestStorage();
+ $storage2 = $this->getTestStorage();
+ \OC\Files\Filesystem::mount($storage1, array(), '/');
+ \OC\Files\Filesystem::mount($storage2, array(), '/substorage');
+
+ $rootView = new \OC\Files\View('');
+ $rootView->rename('foo.txt', 'substorage/folder/foo.txt');
+ $this->assertFalse($rootView->file_exists('foo.txt'));
+ $this->assertTrue($rootView->file_exists('substorage/folder/foo.txt'));
+ $rootView->rename('substorage/folder', 'anotherfolder');
+ $this->assertFalse($rootView->is_dir('substorage/folder'));
+ $this->assertTrue($rootView->file_exists('anotherfolder/foo.txt'));
+ $this->assertTrue($rootView->file_exists('anotherfolder/bar.txt'));
+ }
+
/**
* @param bool $scan
* @return \OC\Files\Storage\Storage