summaryrefslogtreecommitdiffstats
path: root/apps/files_encryption/tests/helper.php
diff options
context:
space:
mode:
Diffstat (limited to 'apps/files_encryption/tests/helper.php')
-rw-r--r--apps/files_encryption/tests/helper.php50
1 files changed, 25 insertions, 25 deletions
diff --git a/apps/files_encryption/tests/helper.php b/apps/files_encryption/tests/helper.php
index 88ba9f20d53..bf86860125a 100644
--- a/apps/files_encryption/tests/helper.php
+++ b/apps/files_encryption/tests/helper.php
@@ -6,35 +6,35 @@
* See the COPYING-README file.
*/
-use OCA\Encryption;
+namespace OCA\Files_Encryption\Tests;
/**
- * Class Test_Encryption_Helper
+ * Class Helper
*/
-class Test_Encryption_Helper extends \OCA\Files_Encryption\Tests\TestCase {
+class Helper extends TestCase {
const TEST_ENCRYPTION_HELPER_USER1 = "test-helper-user1";
const TEST_ENCRYPTION_HELPER_USER2 = "test-helper-user2";
protected function setUpUsers() {
// create test user
- self::loginHelper(\Test_Encryption_Helper::TEST_ENCRYPTION_HELPER_USER2, true);
- self::loginHelper(\Test_Encryption_Helper::TEST_ENCRYPTION_HELPER_USER1, true);
+ self::loginHelper(self::TEST_ENCRYPTION_HELPER_USER2, true);
+ self::loginHelper(self::TEST_ENCRYPTION_HELPER_USER1, true);
}
protected function cleanUpUsers() {
// cleanup test user
- \OC_User::deleteUser(\Test_Encryption_Helper::TEST_ENCRYPTION_HELPER_USER1);
- \OC_User::deleteUser(\Test_Encryption_Helper::TEST_ENCRYPTION_HELPER_USER2);
+ \OC_User::deleteUser(self::TEST_ENCRYPTION_HELPER_USER1);
+ \OC_User::deleteUser(self::TEST_ENCRYPTION_HELPER_USER2);
}
public static function setupHooks() {
// Filesystem related hooks
- \OCA\Encryption\Helper::registerFilesystemHooks();
+ \OCA\Files_Encryption\Helper::registerFilesystemHooks();
// clear and register hooks
\OC_FileProxy::clearProxies();
- \OC_FileProxy::register(new OCA\Encryption\Proxy());
+ \OC_FileProxy::register(new \OCA\Files_Encryption\Proxy());
}
public static function tearDownAfterClass() {
@@ -49,13 +49,13 @@ class Test_Encryption_Helper extends \OCA\Files_Encryption\Tests\TestCase {
$partFilename = 'testfile.txt.part';
$filename = 'testfile.txt';
- $this->assertTrue(Encryption\Helper::isPartialFilePath($partFilename));
+ $this->assertTrue(\OCA\Files_Encryption\Helper::isPartialFilePath($partFilename));
- $this->assertEquals('testfile.txt', Encryption\Helper::stripPartialFileExtension($partFilename));
+ $this->assertEquals('testfile.txt', \OCA\Files_Encryption\Helper::stripPartialFileExtension($partFilename));
- $this->assertFalse(Encryption\Helper::isPartialFilePath($filename));
+ $this->assertFalse(\OCA\Files_Encryption\Helper::isPartialFilePath($filename));
- $this->assertEquals('testfile.txt', Encryption\Helper::stripPartialFileExtension($filename));
+ $this->assertEquals('testfile.txt', \OCA\Files_Encryption\Helper::stripPartialFileExtension($filename));
}
@@ -67,13 +67,13 @@ class Test_Encryption_Helper extends \OCA\Files_Encryption\Tests\TestCase {
$partFilename = 'testfile.txt.ocTransferId643653835.part';
$filename = 'testfile.txt';
- $this->assertTrue(Encryption\Helper::isPartialFilePath($partFilename));
+ $this->assertTrue(\OCA\Files_Encryption\Helper::isPartialFilePath($partFilename));
- $this->assertEquals('testfile.txt', Encryption\Helper::stripPartialFileExtension($partFilename));
+ $this->assertEquals('testfile.txt', \OCA\Files_Encryption\Helper::stripPartialFileExtension($partFilename));
- $this->assertFalse(Encryption\Helper::isPartialFilePath($filename));
+ $this->assertFalse(\OCA\Files_Encryption\Helper::isPartialFilePath($filename));
- $this->assertEquals('testfile.txt', Encryption\Helper::stripPartialFileExtension($filename));
+ $this->assertEquals('testfile.txt', \OCA\Files_Encryption\Helper::stripPartialFileExtension($filename));
}
function testGetPathToRealFile() {
@@ -85,8 +85,8 @@ class Test_Encryption_Helper extends \OCA\Files_Encryption\Tests\TestCase {
$versionPath = "/user/files_versions/foo/bar/test.txt.v456756835";
$cachePath = "/user/cache/transferid636483/foo/bar/test.txt";
- $this->assertEquals($relativePath, Encryption\Helper::getPathToRealFile($versionPath));
- $this->assertEquals($relativePath, Encryption\Helper::getPathToRealFile($cachePath));
+ $this->assertEquals($relativePath, \OCA\Files_Encryption\Helper::getPathToRealFile($versionPath));
+ $this->assertEquals($relativePath, \OCA\Files_Encryption\Helper::getPathToRealFile($cachePath));
}
function testGetUser() {
@@ -100,20 +100,20 @@ class Test_Encryption_Helper extends \OCA\Files_Encryption\Tests\TestCase {
self::loginHelper(self::TEST_ENCRYPTION_HELPER_USER1);
// if we are logged-in every path should return the currently logged-in user
- $this->assertEquals(self::TEST_ENCRYPTION_HELPER_USER1, Encryption\Helper::getUser($path3));
+ $this->assertEquals(self::TEST_ENCRYPTION_HELPER_USER1, \OCA\Files_Encryption\Helper::getUser($path3));
// now log out
self::logoutHelper();
// now we should only get the user from /user/files and user/cache paths
- $this->assertEquals(self::TEST_ENCRYPTION_HELPER_USER1, Encryption\Helper::getUser($path1));
- $this->assertEquals(self::TEST_ENCRYPTION_HELPER_USER1, Encryption\Helper::getUser($path2));
+ $this->assertEquals(self::TEST_ENCRYPTION_HELPER_USER1, \OCA\Files_Encryption\Helper::getUser($path1));
+ $this->assertEquals(self::TEST_ENCRYPTION_HELPER_USER1, \OCA\Files_Encryption\Helper::getUser($path2));
- $this->assertFalse(Encryption\Helper::getUser($path3));
- $this->assertFalse(Encryption\Helper::getUser($path4));
+ $this->assertFalse(\OCA\Files_Encryption\Helper::getUser($path3));
+ $this->assertFalse(\OCA\Files_Encryption\Helper::getUser($path4));
// Log-in again
- self::loginHelper(\Test_Encryption_Helper::TEST_ENCRYPTION_HELPER_USER1);
+ self::loginHelper(self::TEST_ENCRYPTION_HELPER_USER1);
self::cleanUpUsers();
}