diff options
author | Florin Peter <github@florin-peter.de> | 2013-05-24 20:54:13 +0200 |
---|---|---|
committer | Florin Peter <github@florin-peter.de> | 2013-05-24 20:54:13 +0200 |
commit | 946e9ccc0ade60bb9ff34ace9e94e85cce6af96c (patch) | |
tree | 4770fb73b25d6eb50caa2149df8fb06dd8928a45 /tests/lib | |
parent | 5076c0d392f6eb17e368a9382cf5b0abe7408889 (diff) | |
parent | ae9adcaf8cc1f2b279494cfdd30a1d62d41f5060 (diff) | |
download | nextcloud-server-946e9ccc0ade60bb9ff34ace9e94e85cce6af96c.tar.gz nextcloud-server-946e9ccc0ade60bb9ff34ace9e94e85cce6af96c.zip |
Merge branch 'master' into fix_for_2377
Diffstat (limited to 'tests/lib')
-rw-r--r-- | tests/lib/cache/file.php | 11 | ||||
-rw-r--r-- | tests/lib/files/view.php | 37 |
2 files changed, 43 insertions, 5 deletions
diff --git a/tests/lib/cache/file.php b/tests/lib/cache/file.php index 5dcd3268804..7da5a8b85c6 100644 --- a/tests/lib/cache/file.php +++ b/tests/lib/cache/file.php @@ -31,12 +31,13 @@ class Test_Cache_File extends Test_Cache { //clear all proxies and hooks so we can do clean testing OC_FileProxy::clearProxies(); OC_Hook::clear('OC_Filesystem'); - + + //disabled atm //enable only the encryption hook if needed - if(OC_App::isEnabled('files_encryption')) { - OC_FileProxy::register(new OC_FileProxy_Encryption()); - } - + //if(OC_App::isEnabled('files_encryption')) { + // OC_FileProxy::register(new OC_FileProxy_Encryption()); + //} + //set up temporary storage \OC\Files\Filesystem::clearMounts(); \OC\Files\Filesystem::mount('\OC\Files\Storage\Temporary',array(),'/'); diff --git a/tests/lib/files/view.php b/tests/lib/files/view.php index af97761bbb7..01f9a9cca11 100644 --- a/tests/lib/files/view.php +++ b/tests/lib/files/view.php @@ -234,6 +234,43 @@ 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->mkdir('substorage/emptyfolder'); + $rootView->copy('substorage', 'anotherfolder'); + $this->assertTrue($rootView->is_dir('/anotherfolder')); + $this->assertTrue($rootView->is_dir('/substorage')); + $this->assertTrue($rootView->is_dir('/anotherfolder/emptyfolder')); + $this->assertTrue($rootView->is_dir('/substorage/emptyfolder')); + $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')); + } + function testTouch() { $storage = $this->getTestStorage(true, '\Test\Files\TemporaryNoTouch'); |