diff options
author | Florin Peter <github@florin-peter.de> | 2013-05-15 22:42:22 +0200 |
---|---|---|
committer | Florin Peter <github@florin-peter.de> | 2013-05-15 22:42:22 +0200 |
commit | b75a0abb6bee24b3f6e8276d129af3271a05e5d1 (patch) | |
tree | 3a585af7c777092cccf73e035f470e87b52d64f2 /apps | |
parent | ec2e193a4413fa2d02ab6d127b1697294330e2bf (diff) | |
download | nextcloud-server-b75a0abb6bee24b3f6e8276d129af3271a05e5d1.tar.gz nextcloud-server-b75a0abb6bee24b3f6e8276d129af3271a05e5d1.zip |
added test for rename folder
Diffstat (limited to 'apps')
-rwxr-xr-x | apps/files_encryption/tests/crypt.php | 36 |
1 files changed, 34 insertions, 2 deletions
diff --git a/apps/files_encryption/tests/crypt.php b/apps/files_encryption/tests/crypt.php index f84536aaa13..6168f69415e 100755 --- a/apps/files_encryption/tests/crypt.php +++ b/apps/files_encryption/tests/crypt.php @@ -690,6 +690,38 @@ class Test_Crypt extends \PHPUnit_Framework_TestCase { $view->unlink( $newFolder ); } + function testRenameFolder() { + + $filename = '/tmp-'.time(); + + $folder = '/folder'; + $newFolder = '/newfolder'; + $view = new \OC\Files\View('/' . $this->userId . '/files'); + $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 ); + + // rename folder + $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 testChangePassphrase() { $filename = 'tmp-'.time(); @@ -706,7 +738,7 @@ class Test_Crypt extends \PHPUnit_Framework_TestCase { $this->assertEquals( $this->dataLong, $decrypt ); // change password - \OC_User::setPassword('admin', 'test'); + \OC_User::setPassword($this->userId, 'test'); // relogin $params['uid'] = $this->userId; @@ -720,7 +752,7 @@ class Test_Crypt extends \PHPUnit_Framework_TestCase { // tear down // change password back - \OC_User::setPassword('admin', 'admin'); + \OC_User::setPassword($this->userId, $this->pass); $view = new \OC\Files\View('/' . $this->userId . '/files'); $view->unlink( $filename ); } |