[Pkg-owncloud-commits] [owncloud] 27/122: Simplify the test

David Prévot taffit at moszumanska.debian.org
Sat May 9 00:00:05 UTC 2015


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to branch stable8
in repository owncloud.

commit 4a6808a0f4ea1a441599627fca6679513c93af95
Author: Joas Schilling <nickvergessen at owncloud.com>
Date:   Mon Apr 27 15:23:14 2015 +0200

    Simplify the test
---
 apps/encryption/lib/crypto/encryption.php           |  6 ++++--
 apps/encryption/tests/lib/crypto/cryptTest.php      |  2 +-
 apps/encryption/tests/lib/crypto/encryptionTest.php | 14 +++-----------
 3 files changed, 8 insertions(+), 14 deletions(-)

diff --git a/apps/encryption/lib/crypto/encryption.php b/apps/encryption/lib/crypto/encryption.php
index 0fb6f25..29fda09 100644
--- a/apps/encryption/lib/crypto/encryption.php
+++ b/apps/encryption/lib/crypto/encryption.php
@@ -179,8 +179,10 @@ class Encryption implements IEncryptionModule {
 				try {
 					$publicKeys[$uid] = $this->keyManager->getPublicKey($uid);
 				} catch (PublicKeyMissingException $e) {
-					$this->logger->warning('no public key found for user \'' . $uid .
-						'\', user will not be able to read the file', array('app' => 'encryption'));
+					$this->logger->warning(
+						'no public key found for user "{uid}", user will not be able to read the file',
+						['app' => 'encryption', 'uid' => $uid]
+					);
 					// if the public key of the owner is missing we should fail
 					if ($uid === $this->user) {
 						throw $e;
diff --git a/apps/encryption/tests/lib/crypto/cryptTest.php b/apps/encryption/tests/lib/crypto/cryptTest.php
index 3ea5766..4114adb 100644
--- a/apps/encryption/tests/lib/crypto/cryptTest.php
+++ b/apps/encryption/tests/lib/crypto/cryptTest.php
@@ -20,7 +20,7 @@
  */
 
 
-namespace OCA\Encryption\Tests\Crypt;
+namespace OCA\Encryption\Tests\lib\Crypto;
 
 
 use OCA\Encryption\Crypto\Crypt;
diff --git a/apps/encryption/tests/lib/crypto/encryptionTest.php b/apps/encryption/tests/lib/crypto/encryptionTest.php
index 70e48a2..aa28a8b 100644
--- a/apps/encryption/tests/lib/crypto/encryptionTest.php
+++ b/apps/encryption/tests/lib/crypto/encryptionTest.php
@@ -19,7 +19,7 @@
  *
  */
 
-namespace OCA\Encryption\Tests\Crypto;
+namespace OCA\Encryption\Tests\lib\Crypto;
 
 use OCA\Encryption\Exceptions\PublicKeyMissingException;
 use Test\TestCase;
@@ -92,16 +92,8 @@ class EncryptionTest extends TestCase {
 	 */
 	public function endTest() {
 		// prepare internal variables
-		$class = get_class($this->instance);
-		$module = new \ReflectionClass($class);
-		$isWriteOperation = $module->getProperty('isWriteOperation');
-		$writeCache = $module->getProperty('writeCache');
-		$isWriteOperation->setAccessible(true);
-		$writeCache->setAccessible(true);
-		$isWriteOperation->setValue($this->instance, true);
-		$writeCache->setValue($this->instance, '');
-		$isWriteOperation->setAccessible(false);
-		$writeCache->setAccessible(false);
+		\Test_Helper::invokePrivate($this->instance, 'isWriteOperation', [true]);
+		\Test_Helper::invokePrivate($this->instance, 'writeCache', ['']);
 
 		$this->keyManagerMock->expects($this->any())
 			->method('getPublicKey')

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud.git



More information about the Pkg-owncloud-commits mailing list