From 9b7f02f26736542a596d6e1dfb3b8cd9d1875395 Mon Sep 17 00:00:00 2001 From: Florin Peter Date: Wed, 15 May 2013 10:20:52 +0200 Subject: removed FileProxy from test --- tests/lib/cache/file.php | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'tests/lib') 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(),'/'); -- cgit v1.2.3 From e9b71eed691050e23d78910abdd8bf313f2f83cb Mon Sep 17 00:00:00 2001 From: Michael Gapczynski Date: Sun, 19 May 2013 14:20:46 -0400 Subject: Add tests for copying/moving between storages --- tests/lib/files/view.php | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) (limited to 'tests/lib') 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 -- cgit v1.2.3 From fc5bce1f76a3a67a4ac9095d15441e363dfd03d1 Mon Sep 17 00:00:00 2001 From: Michael Gapczynski Date: Sun, 19 May 2013 15:04:41 -0400 Subject: Fix undefined variable for copying empty folders --- lib/files/view.php | 2 +- tests/lib/files/view.php | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) (limited to 'tests/lib') diff --git a/lib/files/view.php b/lib/files/view.php index 875a6c1a1f8..8a37a0bcc62 100644 --- a/lib/files/view.php +++ b/lib/files/view.php @@ -467,7 +467,7 @@ class View { } } else { if ($this->is_dir($path1) && ($dh = $this->opendir($path1))) { - $this->mkdir($path2); + $result = $this->mkdir($path2); while ($file = readdir($dh)) { if (!Filesystem::isIgnoredDir($file)) { $result = $this->copy($path1 . '/' . $file, $path2 . '/' . $file); diff --git a/tests/lib/files/view.php b/tests/lib/files/view.php index 554bc7291ad..a51d99e793d 100644 --- a/tests/lib/files/view.php +++ b/tests/lib/files/view.php @@ -235,9 +235,12 @@ class View extends \PHPUnit_Framework_TestCase { \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')); -- cgit v1.2.3