summaryrefslogtreecommitdiffstats
path: root/apps/encryption
diff options
context:
space:
mode:
authorJoas Schilling <nickvergessen@owncloud.com>2015-06-03 12:03:02 +0200
committerJoas Schilling <nickvergessen@owncloud.com>2015-06-03 12:33:29 +0200
commitd3e3a84cae9c8926bcff810a0e16bb9dcd024888 (patch)
tree80d5588474a46f07c6dd8da142c429c3655f058f /apps/encryption
parent500748725c46803ff2a0ec291db37a831322012c (diff)
downloadnextcloud-server-d3e3a84cae9c8926bcff810a0e16bb9dcd024888.tar.gz
nextcloud-server-d3e3a84cae9c8926bcff810a0e16bb9dcd024888.zip
Move the helpful method to the TestCase class
Diffstat (limited to 'apps/encryption')
-rw-r--r--apps/encryption/tests/lib/HookManagerTest.php4
-rw-r--r--apps/encryption/tests/lib/KeyManagerTest.php6
-rw-r--r--apps/encryption/tests/lib/MigrationTest.php2
-rw-r--r--apps/encryption/tests/lib/RecoveryTest.php2
-rw-r--r--apps/encryption/tests/lib/crypto/cryptTest.php20
-rw-r--r--apps/encryption/tests/lib/crypto/encryptionTest.php10
6 files changed, 22 insertions, 22 deletions
diff --git a/apps/encryption/tests/lib/HookManagerTest.php b/apps/encryption/tests/lib/HookManagerTest.php
index 3da0bafb691..fb74c05546b 100644
--- a/apps/encryption/tests/lib/HookManagerTest.php
+++ b/apps/encryption/tests/lib/HookManagerTest.php
@@ -43,7 +43,7 @@ class HookManagerTest extends TestCase {
$this->getMock('NotIHook')
]);
- $hookInstances = \Test_Helper::invokePrivate(self::$instance, 'hookInstances');
+ $hookInstances = self::invokePrivate(self::$instance, 'hookInstances');
// Make sure our type checking works
$this->assertCount(2, $hookInstances);
}
@@ -66,7 +66,7 @@ class HookManagerTest extends TestCase {
$mock = $this->getMockBuilder('OCA\Encryption\Hooks\Contracts\IHook')->disableOriginalConstructor()->getMock();
self::$instance->registerHook($mock);
- $hookInstances = \Test_Helper::invokePrivate(self::$instance, 'hookInstances');
+ $hookInstances = self::invokePrivate(self::$instance, 'hookInstances');
$this->assertCount(3, $hookInstances);
}
diff --git a/apps/encryption/tests/lib/KeyManagerTest.php b/apps/encryption/tests/lib/KeyManagerTest.php
index 6e9c6d15818..eb43d5a843f 100644
--- a/apps/encryption/tests/lib/KeyManagerTest.php
+++ b/apps/encryption/tests/lib/KeyManagerTest.php
@@ -285,7 +285,7 @@ class KeyManagerTest extends TestCase {
->with('user1', 'privateKey')
->willReturn(true);
- $this->assertTrue(\Test_Helper::invokePrivate($this->instance,
+ $this->assertTrue(self::invokePrivate($this->instance,
'deletePrivateKey',
[$this->userId]));
}
@@ -329,8 +329,8 @@ class KeyManagerTest extends TestCase {
});
// set key IDs
- \Test_Helper::invokePrivate($this->instance, 'publicShareKeyId', [$publicShareKeyId]);
- \Test_Helper::invokePrivate($this->instance, 'recoveryKeyId', [$recoveryKeyId]);
+ self::invokePrivate($this->instance, 'publicShareKeyId', [$publicShareKeyId]);
+ self::invokePrivate($this->instance, 'recoveryKeyId', [$recoveryKeyId]);
$result = $this->instance->addSystemKeys($accessList, $publicKeys, $uid);
diff --git a/apps/encryption/tests/lib/MigrationTest.php b/apps/encryption/tests/lib/MigrationTest.php
index f56ff5cc2f7..c876cea05c9 100644
--- a/apps/encryption/tests/lib/MigrationTest.php
+++ b/apps/encryption/tests/lib/MigrationTest.php
@@ -292,7 +292,7 @@ class MigrationTest extends \Test\TestCase {
public function testUpdateFileCache() {
$this->prepareFileCache();
$m = new Migration(\OC::$server->getConfig(), new \OC\Files\View(), \OC::$server->getDatabaseConnection());
- \Test_Helper::invokePrivate($m, 'updateFileCache');
+ self::invokePrivate($m, 'updateFileCache');
// check results
diff --git a/apps/encryption/tests/lib/RecoveryTest.php b/apps/encryption/tests/lib/RecoveryTest.php
index 5bfafa3a98e..0b85192690b 100644
--- a/apps/encryption/tests/lib/RecoveryTest.php
+++ b/apps/encryption/tests/lib/RecoveryTest.php
@@ -180,7 +180,7 @@ class RecoveryTest extends TestCase {
$this->keyManagerMock->expects($this->once())
->method('setAllFileKeys');
- $this->assertNull(\Test_Helper::invokePrivate($this->instance,
+ $this->assertNull(self::invokePrivate($this->instance,
'recoverFile',
['/', 'testkey', 'admin']));
}
diff --git a/apps/encryption/tests/lib/crypto/cryptTest.php b/apps/encryption/tests/lib/crypto/cryptTest.php
index 4114adb115a..f850725108b 100644
--- a/apps/encryption/tests/lib/crypto/cryptTest.php
+++ b/apps/encryption/tests/lib/crypto/cryptTest.php
@@ -70,7 +70,7 @@ class cryptTest extends TestCase {
->with($this->equalTo('openssl'), $this->equalTo([]))
->willReturn(array());
- $result = \Test_Helper::invokePrivate($this->crypt, 'getOpenSSLConfig');
+ $result = self::invokePrivate($this->crypt, 'getOpenSSLConfig');
$this->assertSame(1, count($result));
$this->assertArrayHasKey('private_key_bits', $result);
$this->assertSame(4096, $result['private_key_bits']);
@@ -86,7 +86,7 @@ class cryptTest extends TestCase {
->with($this->equalTo('openssl'), $this->equalTo([]))
->willReturn(array('foo' => 'bar', 'private_key_bits' => 1028));
- $result = \Test_Helper::invokePrivate($this->crypt, 'getOpenSSLConfig');
+ $result = self::invokePrivate($this->crypt, 'getOpenSSLConfig');
$this->assertSame(2, count($result));
$this->assertArrayHasKey('private_key_bits', $result);
$this->assertArrayHasKey('foo', $result);
@@ -146,7 +146,7 @@ class cryptTest extends TestCase {
*/
public function testConcatIV() {
- $result = \Test_Helper::invokePrivate(
+ $result = self::invokePrivate(
$this->crypt,
'concatIV',
array('content', 'my_iv'));
@@ -161,7 +161,7 @@ class cryptTest extends TestCase {
*/
public function testSplitIV() {
$data = 'encryptedContent00iv001234567890123456';
- $result = \Test_Helper::invokePrivate($this->crypt, 'splitIV', array($data));
+ $result = self::invokePrivate($this->crypt, 'splitIV', array($data));
$this->assertTrue(is_array($result));
$this->assertSame(2, count($result));
$this->assertArrayHasKey('encrypted', $result);
@@ -174,7 +174,7 @@ class cryptTest extends TestCase {
* test addPadding()
*/
public function testAddPadding() {
- $result = \Test_Helper::invokePrivate($this->crypt, 'addPadding', array('data'));
+ $result = self::invokePrivate($this->crypt, 'addPadding', array('data'));
$this->assertSame('dataxx', $result);
}
@@ -186,7 +186,7 @@ class cryptTest extends TestCase {
* @param $expected
*/
public function testRemovePadding($data, $expected) {
- $result = \Test_Helper::invokePrivate($this->crypt, 'removePadding', array($data));
+ $result = self::invokePrivate($this->crypt, 'removePadding', array($data));
$this->assertSame($expected, $result);
}
@@ -208,7 +208,7 @@ class cryptTest extends TestCase {
public function testParseHeader() {
$header= 'HBEGIN:foo:bar:cipher:AES-256-CFB:HEND';
- $result = \Test_Helper::invokePrivate($this->crypt, 'parseHeader', array($header));
+ $result = self::invokePrivate($this->crypt, 'parseHeader', array($header));
$this->assertTrue(is_array($result));
$this->assertSame(2, count($result));
@@ -227,12 +227,12 @@ class cryptTest extends TestCase {
$decrypted = 'content';
$password = 'password';
- $iv = \Test_Helper::invokePrivate($this->crypt, 'generateIv');
+ $iv = self::invokePrivate($this->crypt, 'generateIv');
$this->assertTrue(is_string($iv));
$this->assertSame(16, strlen($iv));
- $result = \Test_Helper::invokePrivate($this->crypt, 'encrypt', array($decrypted, $iv, $password));
+ $result = self::invokePrivate($this->crypt, 'encrypt', array($decrypted, $iv, $password));
$this->assertTrue(is_string($result));
@@ -251,7 +251,7 @@ class cryptTest extends TestCase {
*/
public function testDecrypt($data) {
- $result = \Test_Helper::invokePrivate(
+ $result = self::invokePrivate(
$this->crypt,
'decrypt',
array($data['encrypted'], $data['iv'], $data['password']));
diff --git a/apps/encryption/tests/lib/crypto/encryptionTest.php b/apps/encryption/tests/lib/crypto/encryptionTest.php
index d33aff877bf..c6c0d57eff5 100644
--- a/apps/encryption/tests/lib/crypto/encryptionTest.php
+++ b/apps/encryption/tests/lib/crypto/encryptionTest.php
@@ -103,8 +103,8 @@ class EncryptionTest extends TestCase {
*/
public function endTest() {
// prepare internal variables
- \Test_Helper::invokePrivate($this->instance, 'isWriteOperation', [true]);
- \Test_Helper::invokePrivate($this->instance, 'writeCache', ['']);
+ self::invokePrivate($this->instance, 'isWriteOperation', [true]);
+ self::invokePrivate($this->instance, 'writeCache', ['']);
$this->keyManagerMock->expects($this->any())
->method('getPublicKey')
@@ -142,7 +142,7 @@ class EncryptionTest extends TestCase {
*/
public function testGetPathToRealFile($path, $expected) {
$this->assertSame($expected,
- \Test_Helper::invokePrivate($this->instance, 'getPathToRealFile', array($path))
+ self::invokePrivate($this->instance, 'getPathToRealFile', array($path))
);
}
@@ -184,9 +184,9 @@ class EncryptionTest extends TestCase {
$this->assertArrayHasKey('cipher', $result);
$this->assertSame($expected, $result['cipher']);
if ($mode === 'w') {
- $this->assertTrue(\Test_Helper::invokePrivate($this->instance, 'isWriteOperation'));
+ $this->assertTrue(self::invokePrivate($this->instance, 'isWriteOperation'));
} else {
- $this->assertFalse(\Test_Helper::invokePrivate($this->instance, 'isWriteOperation'));
+ $this->assertFalse(self::invokePrivate($this->instance, 'isWriteOperation'));
}
}