diff options
-rw-r--r-- | apps/encryption/lib/AppInfo/Application.php (renamed from apps/encryption/appinfo/application.php) | 0 | ||||
-rw-r--r-- | apps/encryption/lib/Command/EnableMasterKey.php (renamed from apps/encryption/command/enablemasterkey.php) | 0 | ||||
-rw-r--r-- | apps/encryption/lib/Command/MigrateKeys.php (renamed from apps/encryption/command/migratekeys.php) | 0 | ||||
-rw-r--r-- | apps/encryption/lib/Controller/RecoveryController.php (renamed from apps/encryption/controller/recoverycontroller.php) | 0 | ||||
-rw-r--r-- | apps/encryption/lib/Controller/SettingsController.php (renamed from apps/encryption/controller/settingscontroller.php) | 0 | ||||
-rw-r--r-- | apps/encryption/lib/Controller/StatusController.php (renamed from apps/encryption/controller/statuscontroller.php) | 0 | ||||
-rw-r--r-- | apps/encryption/lib/Crypto/Crypt.php (renamed from apps/encryption/lib/crypto/crypt.php) | 0 | ||||
-rw-r--r-- | apps/encryption/lib/Crypto/DecryptAll.php (renamed from apps/encryption/lib/crypto/decryptall.php) | 0 | ||||
-rw-r--r-- | apps/encryption/lib/Crypto/EncryptAll.php (renamed from apps/encryption/lib/crypto/encryptall.php) | 0 | ||||
-rw-r--r-- | apps/encryption/lib/Crypto/Encryption.php (renamed from apps/encryption/lib/crypto/encryption.php) | 0 | ||||
-rw-r--r-- | apps/encryption/lib/Exceptions/MultiKeyDecryptException.php (renamed from apps/encryption/lib/exceptions/multikeydecryptexception.php) | 0 | ||||
-rw-r--r-- | apps/encryption/lib/Exceptions/MultiKeyEncryptException.php (renamed from apps/encryption/lib/exceptions/multikeyencryptexception.php) | 0 | ||||
-rw-r--r-- | apps/encryption/lib/Exceptions/PrivateKeyMissingException.php (renamed from apps/encryption/lib/exceptions/privatekeymissingexception.php) | 0 | ||||
-rw-r--r-- | apps/encryption/lib/Exceptions/PublicKeyMissingException.php (renamed from apps/encryption/lib/exceptions/publickeymissingexception.php) | 0 | ||||
-rw-r--r-- | apps/encryption/lib/HookManager.php (renamed from apps/encryption/lib/hookmanager.php) | 0 | ||||
-rw-r--r-- | apps/encryption/lib/Hooks/Contracts/IHook.php (renamed from apps/encryption/hooks/contracts/ihook.php) | 0 | ||||
-rw-r--r-- | apps/encryption/lib/Hooks/UserHooks.php (renamed from apps/encryption/hooks/userhooks.php) | 0 | ||||
-rw-r--r-- | apps/encryption/lib/KeyManager.php (renamed from apps/encryption/lib/keymanager.php) | 0 | ||||
-rw-r--r-- | apps/encryption/lib/Migration.php (renamed from apps/encryption/lib/migration.php) | 0 | ||||
-rw-r--r-- | apps/encryption/lib/Recovery.php (renamed from apps/encryption/lib/recovery.php) | 0 | ||||
-rw-r--r-- | apps/encryption/lib/Session.php (renamed from apps/encryption/lib/session.php) | 0 | ||||
-rw-r--r-- | apps/encryption/lib/Users/Setup.php (renamed from apps/encryption/lib/users/setup.php) | 0 | ||||
-rw-r--r-- | apps/encryption/lib/Util.php (renamed from apps/encryption/lib/util.php) | 0 | ||||
-rw-r--r-- | apps/encryption/tests/Command/TestEnableMasterKey.php (renamed from apps/encryption/tests/command/testenablemasterkey.php) | 1 | ||||
-rw-r--r-- | apps/encryption/tests/Controller/RecoveryControllerTest.php (renamed from apps/encryption/tests/controller/RecoveryControllerTest.php) | 52 | ||||
-rw-r--r-- | apps/encryption/tests/Controller/SettingsControllerTest.php (renamed from apps/encryption/tests/controller/SettingsControllerTest.php) | 20 | ||||
-rw-r--r-- | apps/encryption/tests/Controller/StatusControllerTest.php (renamed from apps/encryption/tests/controller/StatusControllerTest.php) | 8 | ||||
-rw-r--r-- | apps/encryption/tests/Crypto/CryptTest.php (renamed from apps/encryption/tests/lib/crypto/cryptTest.php) | 15 | ||||
-rw-r--r-- | apps/encryption/tests/Crypto/DecryptAllTest.php (renamed from apps/encryption/tests/lib/crypto/decryptalltest.php) | 2 | ||||
-rw-r--r-- | apps/encryption/tests/Crypto/EncryptAllTest.php (renamed from apps/encryption/tests/lib/crypto/encryptalltest.php) | 2 | ||||
-rw-r--r-- | apps/encryption/tests/Crypto/EncryptionTest.php (renamed from apps/encryption/tests/lib/crypto/encryptionTest.php) | 22 | ||||
-rw-r--r-- | apps/encryption/tests/HookManagerTest.php (renamed from apps/encryption/tests/lib/HookManagerTest.php) | 1 | ||||
-rw-r--r-- | apps/encryption/tests/Hooks/UserHooksTest.php (renamed from apps/encryption/tests/hooks/UserHooksTest.php) | 18 | ||||
-rw-r--r-- | apps/encryption/tests/KeyManagerTest.php (renamed from apps/encryption/tests/lib/KeyManagerTest.php) | 19 | ||||
-rw-r--r-- | apps/encryption/tests/MigrationTest.php (renamed from apps/encryption/tests/lib/MigrationTest.php) | 2 | ||||
-rw-r--r-- | apps/encryption/tests/RecoveryTest.php (renamed from apps/encryption/tests/lib/RecoveryTest.php) | 17 | ||||
-rw-r--r-- | apps/encryption/tests/SessionTest.php (renamed from apps/encryption/tests/lib/SessionTest.php) | 1 | ||||
-rw-r--r-- | apps/encryption/tests/Users/SetupTest.php (renamed from apps/encryption/tests/lib/users/SetupTest.php) | 6 | ||||
-rw-r--r-- | apps/encryption/tests/UtilTest.php (renamed from apps/encryption/tests/lib/UtilTest.php) | 27 |
39 files changed, 115 insertions, 98 deletions
diff --git a/apps/encryption/appinfo/application.php b/apps/encryption/lib/AppInfo/Application.php index c7c8d2a3d31..c7c8d2a3d31 100644 --- a/apps/encryption/appinfo/application.php +++ b/apps/encryption/lib/AppInfo/Application.php diff --git a/apps/encryption/command/enablemasterkey.php b/apps/encryption/lib/Command/EnableMasterKey.php index fd86c221176..fd86c221176 100644 --- a/apps/encryption/command/enablemasterkey.php +++ b/apps/encryption/lib/Command/EnableMasterKey.php diff --git a/apps/encryption/command/migratekeys.php b/apps/encryption/lib/Command/MigrateKeys.php index 88d8d46973f..88d8d46973f 100644 --- a/apps/encryption/command/migratekeys.php +++ b/apps/encryption/lib/Command/MigrateKeys.php diff --git a/apps/encryption/controller/recoverycontroller.php b/apps/encryption/lib/Controller/RecoveryController.php index e4b02e004dc..e4b02e004dc 100644 --- a/apps/encryption/controller/recoverycontroller.php +++ b/apps/encryption/lib/Controller/RecoveryController.php diff --git a/apps/encryption/controller/settingscontroller.php b/apps/encryption/lib/Controller/SettingsController.php index 5c171a23aec..5c171a23aec 100644 --- a/apps/encryption/controller/settingscontroller.php +++ b/apps/encryption/lib/Controller/SettingsController.php diff --git a/apps/encryption/controller/statuscontroller.php b/apps/encryption/lib/Controller/StatusController.php index 99fdc68c3d0..99fdc68c3d0 100644 --- a/apps/encryption/controller/statuscontroller.php +++ b/apps/encryption/lib/Controller/StatusController.php diff --git a/apps/encryption/lib/crypto/crypt.php b/apps/encryption/lib/Crypto/Crypt.php index ca70c88488f..ca70c88488f 100644 --- a/apps/encryption/lib/crypto/crypt.php +++ b/apps/encryption/lib/Crypto/Crypt.php diff --git a/apps/encryption/lib/crypto/decryptall.php b/apps/encryption/lib/Crypto/DecryptAll.php index 694aba2fb89..694aba2fb89 100644 --- a/apps/encryption/lib/crypto/decryptall.php +++ b/apps/encryption/lib/Crypto/DecryptAll.php diff --git a/apps/encryption/lib/crypto/encryptall.php b/apps/encryption/lib/Crypto/EncryptAll.php index 0037c213265..0037c213265 100644 --- a/apps/encryption/lib/crypto/encryptall.php +++ b/apps/encryption/lib/Crypto/EncryptAll.php diff --git a/apps/encryption/lib/crypto/encryption.php b/apps/encryption/lib/Crypto/Encryption.php index 6eff66e72be..6eff66e72be 100644 --- a/apps/encryption/lib/crypto/encryption.php +++ b/apps/encryption/lib/Crypto/Encryption.php diff --git a/apps/encryption/lib/exceptions/multikeydecryptexception.php b/apps/encryption/lib/Exceptions/MultiKeyDecryptException.php index 59bea59344d..59bea59344d 100644 --- a/apps/encryption/lib/exceptions/multikeydecryptexception.php +++ b/apps/encryption/lib/Exceptions/MultiKeyDecryptException.php diff --git a/apps/encryption/lib/exceptions/multikeyencryptexception.php b/apps/encryption/lib/Exceptions/MultiKeyEncryptException.php index bc0872ffdd2..bc0872ffdd2 100644 --- a/apps/encryption/lib/exceptions/multikeyencryptexception.php +++ b/apps/encryption/lib/Exceptions/MultiKeyEncryptException.php diff --git a/apps/encryption/lib/exceptions/privatekeymissingexception.php b/apps/encryption/lib/Exceptions/PrivateKeyMissingException.php index fe162a8f5c4..fe162a8f5c4 100644 --- a/apps/encryption/lib/exceptions/privatekeymissingexception.php +++ b/apps/encryption/lib/Exceptions/PrivateKeyMissingException.php diff --git a/apps/encryption/lib/exceptions/publickeymissingexception.php b/apps/encryption/lib/Exceptions/PublicKeyMissingException.php index 6fad4693dcc..6fad4693dcc 100644 --- a/apps/encryption/lib/exceptions/publickeymissingexception.php +++ b/apps/encryption/lib/Exceptions/PublicKeyMissingException.php diff --git a/apps/encryption/lib/hookmanager.php b/apps/encryption/lib/HookManager.php index a4269dca031..a4269dca031 100644 --- a/apps/encryption/lib/hookmanager.php +++ b/apps/encryption/lib/HookManager.php diff --git a/apps/encryption/hooks/contracts/ihook.php b/apps/encryption/lib/Hooks/Contracts/IHook.php index 4bf7ead8c15..4bf7ead8c15 100644 --- a/apps/encryption/hooks/contracts/ihook.php +++ b/apps/encryption/lib/Hooks/Contracts/IHook.php diff --git a/apps/encryption/hooks/userhooks.php b/apps/encryption/lib/Hooks/UserHooks.php index 136a1832101..136a1832101 100644 --- a/apps/encryption/hooks/userhooks.php +++ b/apps/encryption/lib/Hooks/UserHooks.php diff --git a/apps/encryption/lib/keymanager.php b/apps/encryption/lib/KeyManager.php index 4f22c3def63..4f22c3def63 100644 --- a/apps/encryption/lib/keymanager.php +++ b/apps/encryption/lib/KeyManager.php diff --git a/apps/encryption/lib/migration.php b/apps/encryption/lib/Migration.php index db9541d6f5a..db9541d6f5a 100644 --- a/apps/encryption/lib/migration.php +++ b/apps/encryption/lib/Migration.php diff --git a/apps/encryption/lib/recovery.php b/apps/encryption/lib/Recovery.php index f0ac7bb2383..f0ac7bb2383 100644 --- a/apps/encryption/lib/recovery.php +++ b/apps/encryption/lib/Recovery.php diff --git a/apps/encryption/lib/session.php b/apps/encryption/lib/Session.php index 62cc09b018d..62cc09b018d 100644 --- a/apps/encryption/lib/session.php +++ b/apps/encryption/lib/Session.php diff --git a/apps/encryption/lib/users/setup.php b/apps/encryption/lib/Users/Setup.php index e59340c4ce2..e59340c4ce2 100644 --- a/apps/encryption/lib/users/setup.php +++ b/apps/encryption/lib/Users/Setup.php diff --git a/apps/encryption/lib/util.php b/apps/encryption/lib/Util.php index e87ed478a1a..e87ed478a1a 100644 --- a/apps/encryption/lib/util.php +++ b/apps/encryption/lib/Util.php diff --git a/apps/encryption/tests/command/testenablemasterkey.php b/apps/encryption/tests/Command/TestEnableMasterKey.php index e408a7c2b14..da04e017a15 100644 --- a/apps/encryption/tests/command/testenablemasterkey.php +++ b/apps/encryption/tests/Command/TestEnableMasterKey.php @@ -24,6 +24,7 @@ namespace OCA\Encryption\Tests\Command; use OCA\Encryption\Command\EnableMasterKey; +use OCA\Encryption\Util; use Test\TestCase; class TestEnableMasterKey extends TestCase { diff --git a/apps/encryption/tests/controller/RecoveryControllerTest.php b/apps/encryption/tests/Controller/RecoveryControllerTest.php index a4349139896..63c99e1277d 100644 --- a/apps/encryption/tests/controller/RecoveryControllerTest.php +++ b/apps/encryption/tests/Controller/RecoveryControllerTest.php @@ -28,47 +28,36 @@ use OCP\AppFramework\Http; use Test\TestCase; class RecoveryControllerTest extends TestCase { - /** - * @var RecoveryController - */ + /** @var RecoveryController */ private $controller; - private $appName; - /** - * @var \PHPUnit_Framework_MockObject_MockObject - */ + /** @var \OCP\IRequest|\PHPUnit_Framework_MockObject_MockObject */ private $requestMock; - /** - * @var \PHPUnit_Framework_MockObject_MockObject - */ + /** @var \OCP\IConfig|\PHPUnit_Framework_MockObject_MockObject */ private $configMock; - /** - * @var \PHPUnit_Framework_MockObject_MockObject - */ + /** @var \OCP\IL10N|\PHPUnit_Framework_MockObject_MockObject */ private $l10nMock; - /** - * @var \PHPUnit_Framework_MockObject_MockObject - */ + /** @var \OCA\Encryption\Recovery|\PHPUnit_Framework_MockObject_MockObject */ private $recoveryMock; public function adminRecoveryProvider() { return [ - ['test', 'test', '1', 'Recovery key successfully enabled', HTTP::STATUS_OK], - ['', 'test', '1', 'Missing recovery key password', HTTP::STATUS_BAD_REQUEST], - ['test', '', '1', 'Please repeat the recovery key password', HTTP::STATUS_BAD_REQUEST], - ['test', 'soimething that doesn\'t match', '1', 'Repeated recovery key password does not match the provided recovery key password', HTTP::STATUS_BAD_REQUEST], - ['test', 'test', '0', 'Recovery key successfully disabled', HTTP::STATUS_OK], + ['test', 'test', '1', 'Recovery key successfully enabled', Http::STATUS_OK], + ['', 'test', '1', 'Missing recovery key password', Http::STATUS_BAD_REQUEST], + ['test', '', '1', 'Please repeat the recovery key password', Http::STATUS_BAD_REQUEST], + ['test', 'soimething that doesn\'t match', '1', 'Repeated recovery key password does not match the provided recovery key password', Http::STATUS_BAD_REQUEST], + ['test', 'test', '0', 'Recovery key successfully disabled', Http::STATUS_OK], ]; } /** * @dataProvider adminRecoveryProvider * @param $recoveryPassword - * @param $passconfirm + * @param $passConfirm * @param $enableRecovery * @param $expectedMessage * @param $expectedStatus */ - public function testAdminRecovery($recoveryPassword, $passconfirm, $enableRecovery, $expectedMessage, $expectedStatus) { + public function testAdminRecovery($recoveryPassword, $passConfirm, $enableRecovery, $expectedMessage, $expectedStatus) { $this->recoveryMock->expects($this->any()) @@ -80,7 +69,7 @@ class RecoveryControllerTest extends TestCase { ->willReturn(true); $response = $this->controller->adminRecovery($recoveryPassword, - $passconfirm, + $passConfirm, $enableRecovery); @@ -92,11 +81,11 @@ class RecoveryControllerTest extends TestCase { public function changeRecoveryPasswordProvider() { return [ - ['test', 'test', 'oldtestFail', 'Could not change the password. Maybe the old password was not correct.', HTTP::STATUS_BAD_REQUEST], - ['test', 'test', 'oldtest', 'Password successfully changed.', HTTP::STATUS_OK], - ['test', 'notmatch', 'oldtest', 'Repeated recovery key password does not match the provided recovery key password', HTTP::STATUS_BAD_REQUEST], - ['', 'test', 'oldtest', 'Please provide a new recovery password', HTTP::STATUS_BAD_REQUEST], - ['test', 'test', '', 'Please provide the old recovery password', HTTP::STATUS_BAD_REQUEST] + ['test', 'test', 'oldtestFail', 'Could not change the password. Maybe the old password was not correct.', Http::STATUS_BAD_REQUEST], + ['test', 'test', 'oldtest', 'Password successfully changed.', Http::STATUS_OK], + ['test', 'notmatch', 'oldtest', 'Repeated recovery key password does not match the provided recovery key password', Http::STATUS_BAD_REQUEST], + ['', 'test', 'oldtest', 'Please provide a new recovery password', Http::STATUS_BAD_REQUEST], + ['test', 'test', '', 'Please provide the old recovery password', Http::STATUS_BAD_REQUEST] ]; } @@ -160,8 +149,7 @@ class RecoveryControllerTest extends TestCase { protected function setUp() { parent::setUp(); - $this->appName = 'encryption'; - $this->requestMock = $this->getMockBuilder('\OCP\IRequest') + $this->requestMock = $this->getMockBuilder('OCP\IRequest') ->disableOriginalConstructor() ->getMock(); @@ -182,7 +170,7 @@ class RecoveryControllerTest extends TestCase { ->disableOriginalConstructor() ->getMock(); - $this->controller = new RecoveryController($this->appName, + $this->controller = new RecoveryController('encryption', $this->requestMock, $this->configMock, $this->l10nMock, diff --git a/apps/encryption/tests/controller/SettingsControllerTest.php b/apps/encryption/tests/Controller/SettingsControllerTest.php index 61391a33002..8180cae113f 100644 --- a/apps/encryption/tests/controller/SettingsControllerTest.php +++ b/apps/encryption/tests/Controller/SettingsControllerTest.php @@ -32,31 +32,31 @@ class SettingsControllerTest extends TestCase { /** @var SettingsController */ private $controller; - /** @var \PHPUnit_Framework_MockObject_MockObject */ + /** @var \OCP\IRequest|\PHPUnit_Framework_MockObject_MockObject */ private $requestMock; - /** @var \PHPUnit_Framework_MockObject_MockObject */ + /** @var \OCP\IL10N|\PHPUnit_Framework_MockObject_MockObject */ private $l10nMock; - /** @var \PHPUnit_Framework_MockObject_MockObject */ + /** @var \OCP\IUserManager|\PHPUnit_Framework_MockObject_MockObject */ private $userManagerMock; - /** @var \PHPUnit_Framework_MockObject_MockObject */ + /** @var \OCP\IUserSession|\PHPUnit_Framework_MockObject_MockObject */ private $userSessionMock; - /** @var \PHPUnit_Framework_MockObject_MockObject */ + /** @var \OCA\Encryption\KeyManager|\PHPUnit_Framework_MockObject_MockObject */ private $keyManagerMock; - /** @var \PHPUnit_Framework_MockObject_MockObject */ + /** @var \OCA\Encryption\Crypto\Crypt|\PHPUnit_Framework_MockObject_MockObject */ private $cryptMock; - /** @var \PHPUnit_Framework_MockObject_MockObject */ + /** @var \OCA\Encryption\Session|\PHPUnit_Framework_MockObject_MockObject */ private $sessionMock; - /** @var \PHPUnit_Framework_MockObject_MockObject */ + /** @var \OCP\ISession|\PHPUnit_Framework_MockObject_MockObject */ private $ocSessionMock; - /** @var \PHPUnit_Framework_MockObject_MockObject */ + /** @var \OCA\Encryption\Util|\PHPUnit_Framework_MockObject_MockObject */ private $utilMock; protected function setUp() { @@ -96,7 +96,7 @@ class SettingsControllerTest extends TestCase { ]) ->getMock(); - $this->ocSessionMock = $this->getMockBuilder('\OCP\ISession')->disableOriginalConstructor()->getMock(); + $this->ocSessionMock = $this->getMockBuilder('OCP\ISession')->disableOriginalConstructor()->getMock(); $this->userSessionMock->expects($this->any()) ->method('getUID') diff --git a/apps/encryption/tests/controller/StatusControllerTest.php b/apps/encryption/tests/Controller/StatusControllerTest.php index 3c937623b7a..0410b36cd2a 100644 --- a/apps/encryption/tests/controller/StatusControllerTest.php +++ b/apps/encryption/tests/Controller/StatusControllerTest.php @@ -29,11 +29,11 @@ use Test\TestCase; class StatusControllerTest extends TestCase { - /** @var \PHPUnit_Framework_MockObject_MockObject */ - protected $requestMock; + /** @var \OCP\IRequest|\PHPUnit_Framework_MockObject_MockObject */ + private $requestMock; - /** @var \PHPUnit_Framework_MockObject_MockObject */ - protected $l10nMock; + /** @var \OCP\IL10N|\PHPUnit_Framework_MockObject_MockObject */ + private $l10nMock; /** @var \OCA\Encryption\Session | \PHPUnit_Framework_MockObject_MockObject */ protected $sessionMock; diff --git a/apps/encryption/tests/lib/crypto/cryptTest.php b/apps/encryption/tests/Crypto/CryptTest.php index 2f290db21a1..4b8147ab214 100644 --- a/apps/encryption/tests/lib/crypto/cryptTest.php +++ b/apps/encryption/tests/Crypto/CryptTest.php @@ -22,29 +22,28 @@ */ -namespace OCA\Encryption\Tests\lib\Crypto; +namespace OCA\Encryption\Tests\Crypto; use OCA\Encryption\Crypto\Crypt; use Test\TestCase; -class cryptTest extends TestCase { +class CryptTest extends TestCase { - /** @var \PHPUnit_Framework_MockObject_MockObject */ + /** @var \OCP\ILogger|\PHPUnit_Framework_MockObject_MockObject */ private $logger; - /** @var \PHPUnit_Framework_MockObject_MockObject */ + /** @var \OCP\IUserSession|\PHPUnit_Framework_MockObject_MockObject */ private $userSession; - /** @var \PHPUnit_Framework_MockObject_MockObject */ + /** @var \OCP\IConfig|\PHPUnit_Framework_MockObject_MockObject */ private $config; - - /** @var \PHPUnit_Framework_MockObject_MockObject */ + /** @var \OCP\IL10N|\PHPUnit_Framework_MockObject_MockObject */ private $l; - /** @var Crypt */ + /** @var Crypt */ private $crypt; public function setUp() { diff --git a/apps/encryption/tests/lib/crypto/decryptalltest.php b/apps/encryption/tests/Crypto/DecryptAllTest.php index 0945692e427..a094f3b3a2d 100644 --- a/apps/encryption/tests/lib/crypto/decryptalltest.php +++ b/apps/encryption/tests/Crypto/DecryptAllTest.php @@ -20,7 +20,7 @@ */ -namespace OCA\Encryption\Tests\lib\Crypto; +namespace OCA\Encryption\Tests\Crypto; use OCA\Encryption\Crypto\Crypt; diff --git a/apps/encryption/tests/lib/crypto/encryptalltest.php b/apps/encryption/tests/Crypto/EncryptAllTest.php index d31f58377c4..baa80eaaf84 100644 --- a/apps/encryption/tests/lib/crypto/encryptalltest.php +++ b/apps/encryption/tests/Crypto/EncryptAllTest.php @@ -20,7 +20,7 @@ */ -namespace OCA\Encryption\Tests\lib\Crypto; +namespace OCA\Encryption\Tests\Crypto; use OCA\Encryption\Crypto\EncryptAll; diff --git a/apps/encryption/tests/lib/crypto/encryptionTest.php b/apps/encryption/tests/Crypto/EncryptionTest.php index ad20efb4451..723c6e31b90 100644 --- a/apps/encryption/tests/lib/crypto/encryptionTest.php +++ b/apps/encryption/tests/Crypto/EncryptionTest.php @@ -20,7 +20,7 @@ * */ -namespace OCA\Encryption\Tests\lib\Crypto; +namespace OCA\Encryption\Tests\Crypto; use OCA\Encryption\Exceptions\PublicKeyMissingException; use Test\TestCase; @@ -31,31 +31,31 @@ class EncryptionTest extends TestCase { /** @var Encryption */ private $instance; - /** @var \PHPUnit_Framework_MockObject_MockObject */ + /** @var \OCA\Encryption\KeyManager|\PHPUnit_Framework_MockObject_MockObject */ private $keyManagerMock; - /** @var \PHPUnit_Framework_MockObject_MockObject */ + /** @var \OCA\Encryption\Crypto\EncryptAll|\PHPUnit_Framework_MockObject_MockObject */ private $encryptAllMock; - /** @var \PHPUnit_Framework_MockObject_MockObject */ + /** @var \OCA\Encryption\Crypto\DecryptAll|\PHPUnit_Framework_MockObject_MockObject */ private $decryptAllMock; - /** @var \PHPUnit_Framework_MockObject_MockObject */ + /** @var \OCA\Encryption\Session|\PHPUnit_Framework_MockObject_MockObject */ private $sessionMock; - /** @var \PHPUnit_Framework_MockObject_MockObject */ + /** @var \OCA\Encryption\Crypto\Crypt|\PHPUnit_Framework_MockObject_MockObject */ private $cryptMock; - /** @var \PHPUnit_Framework_MockObject_MockObject */ + /** @var \OCA\Encryption\Util|\PHPUnit_Framework_MockObject_MockObject */ private $utilMock; - /** @var \PHPUnit_Framework_MockObject_MockObject */ + /** @var \OCP\ILogger|\PHPUnit_Framework_MockObject_MockObject */ private $loggerMock; - /** @var \PHPUnit_Framework_MockObject_MockObject */ + /** @var \OCP\IL10N|\PHPUnit_Framework_MockObject_MockObject */ private $l10nMock; - /** @var \PHPUnit_Framework_MockObject_MockObject */ + /** @var \OCP\Files\Storage|\PHPUnit_Framework_MockObject_MockObject */ private $storageMock; public function setUp() { @@ -410,7 +410,9 @@ class EncryptionTest extends TestCase { } public function testPrepareDecryptAll() { + /** @var \Symfony\Component\Console\Input\InputInterface $input */ $input = $this->getMock('Symfony\Component\Console\Input\InputInterface'); + /** @var \Symfony\Component\Console\Output\OutputInterface $output */ $output = $this->getMock('Symfony\Component\Console\Output\OutputInterface'); $this->decryptAllMock->expects($this->once())->method('prepare') diff --git a/apps/encryption/tests/lib/HookManagerTest.php b/apps/encryption/tests/HookManagerTest.php index d69674faec0..4228db318a1 100644 --- a/apps/encryption/tests/lib/HookManagerTest.php +++ b/apps/encryption/tests/HookManagerTest.php @@ -65,6 +65,7 @@ class HookManagerTest extends TestCase { */ public function testRegisterHooksWithInstance() { $mock = $this->getMockBuilder('OCA\Encryption\Hooks\Contracts\IHook')->disableOriginalConstructor()->getMock(); + /** @var \OCA\Encryption\Hooks\Contracts\IHook $mock */ self::$instance->registerHook($mock); $hookInstances = self::invokePrivate(self::$instance, 'hookInstances'); diff --git a/apps/encryption/tests/hooks/UserHooksTest.php b/apps/encryption/tests/Hooks/UserHooksTest.php index df3d12b3401..a4767bfb743 100644 --- a/apps/encryption/tests/hooks/UserHooksTest.php +++ b/apps/encryption/tests/Hooks/UserHooksTest.php @@ -70,6 +70,10 @@ class UserHooksTest extends TestCase { */ private $cryptMock; /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + private $loggerMock; + /** * @var UserHooks */ private $instance; @@ -91,15 +95,16 @@ class UserHooksTest extends TestCase { public function testLogout() { $this->sessionMock->expects($this->once()) ->method('clear'); - - $this->assertNull($this->instance->logout()); + $this->instance->logout(); + $this->assertTrue(true); } public function testPostCreateUser() { $this->userSetupMock->expects($this->once()) ->method('setupUser'); - $this->assertNull($this->instance->postCreateUser($this->params)); + $this->instance->postCreateUser($this->params); + $this->assertTrue(true); } public function testPostDeleteUser() { @@ -107,7 +112,8 @@ class UserHooksTest extends TestCase { ->method('deletePublicKey') ->with('testUser'); - $this->assertNull($this->instance->postDeleteUser($this->params)); + $this->instance->postDeleteUser($this->params); + $this->assertTrue(true); } /** @@ -273,6 +279,7 @@ class UserHooksTest extends TestCase { ] )->setMethods(['initMountPoints'])->getMock(); + /** @var \OCA\Encryption\Hooks\UserHooks $userHooks */ $this->assertNull($userHooks->setPassphrase($this->params)); } @@ -285,7 +292,8 @@ class UserHooksTest extends TestCase { ->method('setupUser') ->with('testUser', 'password'); - $this->assertNull($this->instance->postPasswordReset($this->params)); + $this->instance->postPasswordReset($this->params); + $this->assertTrue(true); } protected function setUp() { diff --git a/apps/encryption/tests/lib/KeyManagerTest.php b/apps/encryption/tests/KeyManagerTest.php index 7ede6177deb..6f6fb3a02dd 100644 --- a/apps/encryption/tests/lib/KeyManagerTest.php +++ b/apps/encryption/tests/KeyManagerTest.php @@ -43,25 +43,25 @@ class KeyManagerTest extends TestCase { /** @var string */ private $systemKeyId; - /** @var \PHPUnit_Framework_MockObject_MockObject */ + /** @var \OCP\Encryption\Keys\IStorage|\PHPUnit_Framework_MockObject_MockObject */ private $keyStorageMock; - /** @var \PHPUnit_Framework_MockObject_MockObject */ + /** @var \OCA\Encryption\Crypto\Crypt|\PHPUnit_Framework_MockObject_MockObject */ private $cryptMock; - /** @var \PHPUnit_Framework_MockObject_MockObject */ + /** @var \OCP\IUserSession|\PHPUnit_Framework_MockObject_MockObject */ private $userMock; - /** @var \PHPUnit_Framework_MockObject_MockObject */ + /** @var \OCA\Encryption\Session|\PHPUnit_Framework_MockObject_MockObject */ private $sessionMock; - /** @var \PHPUnit_Framework_MockObject_MockObject */ + /** @var \OCP\ILogger|\PHPUnit_Framework_MockObject_MockObject */ private $logMock; - /** @var \PHPUnit_Framework_MockObject_MockObject */ + /** @var \OCA\Encryption\Util|\PHPUnit_Framework_MockObject_MockObject */ private $utilMock; - /** @var \PHPUnit_Framework_MockObject_MockObject */ + /** @var \OCP\IConfig|\PHPUnit_Framework_MockObject_MockObject */ private $configMock; public function setUp() { @@ -245,6 +245,7 @@ class KeyManagerTest extends TestCase { */ public function testInit($useMasterKey) { + /** @var \OCA\Encryption\KeyManager|\PHPUnit_Framework_MockObject_MockObject $instance */ $instance = $this->getMockBuilder('OCA\Encryption\KeyManager') ->setConstructorArgs( [ @@ -588,6 +589,7 @@ class KeyManagerTest extends TestCase { ->with('/admin/files/myfile.txt') ->willReturn(false); + /** @var \OC\Files\View $view */ $this->assertSame(0, $this->instance->getVersion('/admin/files/myfile.txt', $view)); } @@ -604,6 +606,7 @@ class KeyManagerTest extends TestCase { ->with('/admin/files/myfile.txt') ->willReturn($fileInfo); + /** @var \OC\Files\View $view */ $this->assertSame(1337, $this->instance->getVersion('/admin/files/myfile.txt', $view)); } @@ -633,6 +636,7 @@ class KeyManagerTest extends TestCase { ->with('/admin/files/myfile.txt') ->willReturn($fileInfo); + /** @var \OC\Files\View $view */ $this->instance->setVersion('/admin/files/myfile.txt', 5, $view); } @@ -644,6 +648,7 @@ class KeyManagerTest extends TestCase { ->with('/admin/files/myfile.txt') ->willReturn(false); + /** @var \OC\Files\View $view */ $this->instance->setVersion('/admin/files/myfile.txt', 5, $view); } diff --git a/apps/encryption/tests/lib/MigrationTest.php b/apps/encryption/tests/MigrationTest.php index 18f7c8b35d5..c77693d24a6 100644 --- a/apps/encryption/tests/lib/MigrationTest.php +++ b/apps/encryption/tests/MigrationTest.php @@ -39,7 +39,7 @@ class MigrationTest extends \Test\TestCase { private $recovery_key_id = 'recovery_key_id'; private $moduleId; - /** @var PHPUnit_Framework_MockObject_MockObject | ILogger */ + /** @var \PHPUnit_Framework_MockObject_MockObject | ILogger */ private $logger; public static function setUpBeforeClass() { diff --git a/apps/encryption/tests/lib/RecoveryTest.php b/apps/encryption/tests/RecoveryTest.php index 68c21c80b34..c8bd838242b 100644 --- a/apps/encryption/tests/lib/RecoveryTest.php +++ b/apps/encryption/tests/RecoveryTest.php @@ -32,27 +32,27 @@ use Test\TestCase; class RecoveryTest extends TestCase { private static $tempStorage = []; /** - * @var \PHPUnit_Framework_MockObject_MockObject + * @var \OCP\Encryption\IFile|\PHPUnit_Framework_MockObject_MockObject */ private $fileMock; /** - * @var \PHPUnit_Framework_MockObject_MockObject + * @var \OC\Files\View|\PHPUnit_Framework_MockObject_MockObject */ private $viewMock; /** - * @var \PHPUnit_Framework_MockObject_MockObject + * @var \OCP\IUserSession|\PHPUnit_Framework_MockObject_MockObject */ private $userSessionMock; /** - * @var \PHPUnit_Framework_MockObject_MockObject + * @var \OCA\Encryption\KeyManager|\PHPUnit_Framework_MockObject_MockObject */ private $keyManagerMock; /** - * @var \PHPUnit_Framework_MockObject_MockObject + * @var \OCP\IConfig|\PHPUnit_Framework_MockObject_MockObject */ private $configMock; /** - * @var \PHPUnit_Framework_MockObject_MockObject + * @var \OCA\Encryption\Crypto\Crypt|\PHPUnit_Framework_MockObject_MockObject */ private $cryptMock; /** @@ -201,7 +201,8 @@ class RecoveryTest extends TestCase { $this->cryptMock->expects($this->once()) ->method('decryptPrivateKey'); - $this->assertNull($this->instance->recoverUsersFiles('password', 'admin')); + $this->instance->recoverUsersFiles('password', 'admin'); + $this->assertTrue(true); } public function testRecoverFile() { @@ -265,9 +266,11 @@ class RecoveryTest extends TestCase { ->will($this->returnSelf()); $this->cryptMock = $this->getMockBuilder('OCA\Encryption\Crypto\Crypt')->disableOriginalConstructor()->getMock(); + /** @var \OCP\Security\ISecureRandom $randomMock */ $randomMock = $this->getMock('OCP\Security\ISecureRandom'); $this->keyManagerMock = $this->getMockBuilder('OCA\Encryption\KeyManager')->disableOriginalConstructor()->getMock(); $this->configMock = $this->getMock('OCP\IConfig'); + /** @var \OCP\Encryption\Keys\IStorage $keyStorageMock */ $keyStorageMock = $this->getMock('OCP\Encryption\Keys\IStorage'); $this->fileMock = $this->getMock('OCP\Encryption\IFile'); $this->viewMock = $this->getMock('OC\Files\View'); diff --git a/apps/encryption/tests/lib/SessionTest.php b/apps/encryption/tests/SessionTest.php index f7a8a0369bb..b2944d450a1 100644 --- a/apps/encryption/tests/lib/SessionTest.php +++ b/apps/encryption/tests/SessionTest.php @@ -34,6 +34,7 @@ class SessionTest extends TestCase { * @var Session */ private $instance; + /** @var \OCP\ISession|\PHPUnit_Framework_MockObject_MockObject */ private $sessionMock; /** diff --git a/apps/encryption/tests/lib/users/SetupTest.php b/apps/encryption/tests/Users/SetupTest.php index e7d8afbb102..9e7cbde0c17 100644 --- a/apps/encryption/tests/lib/users/SetupTest.php +++ b/apps/encryption/tests/Users/SetupTest.php @@ -29,11 +29,11 @@ use Test\TestCase; class SetupTest extends TestCase { /** - * @var \PHPUnit_Framework_MockObject_MockObject + * @var \OCA\Encryption\KeyManager|\PHPUnit_Framework_MockObject_MockObject */ private $keyManagerMock; /** - * @var \PHPUnit_Framework_MockObject_MockObject + * @var \OCA\Encryption\Crypto\Crypt|\PHPUnit_Framework_MockObject_MockObject */ private $cryptMock; /** @@ -55,6 +55,8 @@ class SetupTest extends TestCase { ->disableOriginalConstructor() ->getMock(); + /** @var \OCP\ILogger $logMock */ + /** @var \OCP\IUserSession $userSessionMock */ $this->instance = new Setup($logMock, $userSessionMock, $this->cryptMock, diff --git a/apps/encryption/tests/lib/UtilTest.php b/apps/encryption/tests/UtilTest.php index fa90125d6e9..e052bff8633 100644 --- a/apps/encryption/tests/lib/UtilTest.php +++ b/apps/encryption/tests/UtilTest.php @@ -30,16 +30,16 @@ use Test\TestCase; class UtilTest extends TestCase { private static $tempStorage = []; - /** @var \PHPUnit_Framework_MockObject_MockObject */ + /** @var \OCP\IConfig|\PHPUnit_Framework_MockObject_MockObject */ private $configMock; - /** @var \PHPUnit_Framework_MockObject_MockObject */ + /** @var \OC\Files\View|\PHPUnit_Framework_MockObject_MockObject */ private $filesMock; - /** @var \PHPUnit_Framework_MockObject_MockObject */ + /** @var \OCP\IUserManager|\PHPUnit_Framework_MockObject_MockObject */ private $userManagerMock; - /** @var \PHPUnit_Framework_MockObject_MockObject */ + /** @var \OCP\Files\Mount\IMountPoint|\PHPUnit_Framework_MockObject_MockObject */ private $mountMock; /** @var Util */ @@ -72,10 +72,13 @@ class UtilTest extends TestCase { $this->filesMock = $this->getMock('OC\Files\View'); $this->userManagerMock = $this->getMock('\OCP\IUserManager'); + /** @var \OCA\Encryption\Crypto\Crypt $cryptMock */ $cryptMock = $this->getMockBuilder('OCA\Encryption\Crypto\Crypt') ->disableOriginalConstructor() ->getMock(); + /** @var \OCP\ILogger $loggerMock */ $loggerMock = $this->getMock('OCP\ILogger'); + /** @var \OCP\IUserSession|\PHPUnit_Framework_MockObject_MockObject $userSessionMock */ $userSessionMock = $this->getMockBuilder('OCP\IUserSession') ->disableOriginalConstructor() ->setMethods([ @@ -97,7 +100,7 @@ class UtilTest extends TestCase { ->will($this->returnSelf()); - $this->configMock = $configMock = $this->getMock('OCP\IConfig'); + $this->configMock = $this->getMock('OCP\IConfig'); $this->configMock->expects($this->any()) ->method('getUserValue') @@ -107,7 +110,7 @@ class UtilTest extends TestCase { ->method('setUserValue') ->will($this->returnCallback([$this, 'setValueTester'])); - $this->instance = new Util($this->filesMock, $cryptMock, $loggerMock, $userSessionMock, $configMock, $this->userManagerMock); + $this->instance = new Util($this->filesMock, $cryptMock, $loggerMock, $userSessionMock, $this->configMock, $this->userManagerMock); } /** @@ -157,8 +160,8 @@ class UtilTest extends TestCase { /** * @dataProvider dataTestShouldEncryptHomeStorage - * @param $returnValue return value from getAppValue() - * @param $expected + * @param string $returnValue return value from getAppValue() + * @param bool $expected */ public function testShouldEncryptHomeStorage($returnValue, $expected) { $this->configMock->expects($this->once())->method('getAppValue') @@ -195,12 +198,16 @@ class UtilTest extends TestCase { } public function testGetStorage() { + $return = $this->getMockBuilder('OC\Files\Storage\Storage') + ->disableOriginalConstructor() + ->getMock(); + $path = '/foo/bar.txt'; $this->filesMock->expects($this->once())->method('getMount')->with($path) ->willReturn($this->mountMock); - $this->mountMock->expects($this->once())->method('getStorage')->willReturn(true); + $this->mountMock->expects($this->once())->method('getStorage')->willReturn($return); - $this->assertTrue($this->instance->getStorage($path)); + $this->assertEquals($return, $this->instance->getStorage($path)); } } |