瀏覽代碼

Simplify the test

tags/v8.1.0beta1
Joas Schilling 9 年之前
父節點
當前提交
4a6808a0f4

+ 4
- 2
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;

+ 1
- 1
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;

+ 3
- 11
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')

Loading…
取消
儲存