diff options
author | Florin Peter <github@florin-peter.de> | 2013-05-17 22:16:56 +0200 |
---|---|---|
committer | Florin Peter <github@florin-peter.de> | 2013-05-17 22:16:56 +0200 |
commit | b6572cedac8aa26d75ae09062b9e5500b00e845a (patch) | |
tree | 5c73712052337b7547481f26e3392713029a053f /apps | |
parent | cea9208ceccda86a33ec294926d39adecb962ed2 (diff) | |
download | nextcloud-server-b6572cedac8aa26d75ae09062b9e5500b00e845a.tar.gz nextcloud-server-b6572cedac8aa26d75ae09062b9e5500b00e845a.zip |
added folder move test
Diffstat (limited to 'apps')
-rwxr-xr-x | apps/files_encryption/tests/crypt.php | 35 |
1 files changed, 34 insertions, 1 deletions
diff --git a/apps/files_encryption/tests/crypt.php b/apps/files_encryption/tests/crypt.php index 9737eefb96c..16cdc88f1c0 100755 --- a/apps/files_encryption/tests/crypt.php +++ b/apps/files_encryption/tests/crypt.php @@ -649,7 +649,7 @@ class Test_Crypt extends \PHPUnit_Framework_TestCase { $this->assertEquals( $this->dataLong, $decrypt ); - $newFolder = '/newfolder1'; + $newFolder = '/newfolder'.time(); $newFilename = 'tmp-new-'.time(); $view = new \OC\Files\View('/' . $this->userId . '/files'); $view->mkdir($newFolder); @@ -664,6 +664,39 @@ class Test_Crypt extends \PHPUnit_Framework_TestCase { $view->unlink( $newFolder ); } + function testMoveFolder() { + + $view = new \OC\Files\View('/' . $this->userId . '/files'); + + $filename = '/tmp-'.time(); + $folder = '/folder'.time(); + + $view->mkdir($folder); + + // Save long data as encrypted file using stream wrapper + $cryptedFile = file_put_contents( 'crypt://' . $folder . $filename, $this->dataLong ); + + // Test that data was successfully written + $this->assertTrue( is_int( $cryptedFile ) ); + + // Get file decrypted contents + $decrypt = file_get_contents( 'crypt://' . $folder . $filename ); + + $this->assertEquals( $this->dataLong, $decrypt ); + + $newFolder = '/newfolder'.time(); + + $view->rename( $folder, $newFolder ); + + // Get file decrypted contents + $newDecrypt = file_get_contents( 'crypt://' . $newFolder . $filename ); + + $this->assertEquals( $this->dataLong, $newDecrypt ); + + // tear down + $view->unlink( $newFolder ); + } + function testRenameFolder() { $filename = '/tmp-'.time(); |