summaryrefslogtreecommitdiffstats
path: root/apps/encryption/tests
diff options
context:
space:
mode:
authorMorris Jobke <hey@morrisjobke.de>2017-10-24 15:26:53 +0200
committerMorris Jobke <hey@morrisjobke.de>2017-10-24 17:45:32 +0200
commit43e498844e8c1aa519a19238d2cf3d6b95e1aab0 (patch)
tree59510ef2ffc6c1fd1fd92475013b108f1da2bfeb /apps/encryption/tests
parentb1f77aca4effec99387481a831910d4870ae2ffc (diff)
downloadnextcloud-server-43e498844e8c1aa519a19238d2cf3d6b95e1aab0.tar.gz
nextcloud-server-43e498844e8c1aa519a19238d2cf3d6b95e1aab0.zip
Use ::class in test mocks
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
Diffstat (limited to 'apps/encryption/tests')
-rw-r--r--apps/encryption/tests/Command/TestEnableMasterKey.php3
-rw-r--r--apps/encryption/tests/Controller/RecoveryControllerTest.php9
-rw-r--r--apps/encryption/tests/Controller/SettingsControllerTest.php6
-rw-r--r--apps/encryption/tests/Controller/StatusControllerTest.php3
-rw-r--r--apps/encryption/tests/Crypto/CryptTest.php6
-rw-r--r--apps/encryption/tests/Crypto/EncryptAllTest.php15
-rw-r--r--apps/encryption/tests/Crypto/EncryptionTest.php6
-rw-r--r--apps/encryption/tests/Hooks/UserHooksTest.php3
-rw-r--r--apps/encryption/tests/MigrationTest.php5
-rw-r--r--apps/encryption/tests/Settings/AdminTest.php12
10 files changed, 43 insertions, 25 deletions
diff --git a/apps/encryption/tests/Command/TestEnableMasterKey.php b/apps/encryption/tests/Command/TestEnableMasterKey.php
index 75d5fa3d5e7..dac26c5d3c7 100644
--- a/apps/encryption/tests/Command/TestEnableMasterKey.php
+++ b/apps/encryption/tests/Command/TestEnableMasterKey.php
@@ -27,6 +27,7 @@ namespace OCA\Encryption\Tests\Command;
use OCA\Encryption\Command\EnableMasterKey;
use OCA\Encryption\Util;
+use OCP\IConfig;
use Test\TestCase;
class TestEnableMasterKey extends TestCase {
@@ -54,7 +55,7 @@ class TestEnableMasterKey extends TestCase {
$this->util = $this->getMockBuilder('OCA\Encryption\Util')
->disableOriginalConstructor()->getMock();
- $this->config = $this->getMockBuilder('OCP\IConfig')
+ $this->config = $this->getMockBuilder(IConfig::class)
->disableOriginalConstructor()->getMock();
$this->questionHelper = $this->getMockBuilder('Symfony\Component\Console\Helper\QuestionHelper')
->disableOriginalConstructor()->getMock();
diff --git a/apps/encryption/tests/Controller/RecoveryControllerTest.php b/apps/encryption/tests/Controller/RecoveryControllerTest.php
index fd1b0663b49..384cce94c42 100644
--- a/apps/encryption/tests/Controller/RecoveryControllerTest.php
+++ b/apps/encryption/tests/Controller/RecoveryControllerTest.php
@@ -27,6 +27,9 @@ namespace OCA\Encryption\Tests\Controller;
use OCA\Encryption\Controller\RecoveryController;
use OCP\AppFramework\Http;
+use OCP\IConfig;
+use OCP\IL10N;
+use OCP\IRequest;
use Test\TestCase;
class RecoveryControllerTest extends TestCase {
@@ -151,15 +154,15 @@ class RecoveryControllerTest extends TestCase {
protected function setUp() {
parent::setUp();
- $this->requestMock = $this->getMockBuilder('OCP\IRequest')
+ $this->requestMock = $this->getMockBuilder(IRequest::class)
->disableOriginalConstructor()
->getMock();
- $this->configMock = $this->getMockBuilder('OCP\IConfig')
+ $this->configMock = $this->getMockBuilder(IConfig::class)
->disableOriginalConstructor()
->getMock();
- $this->l10nMock = $this->getMockBuilder('OCP\IL10N')
+ $this->l10nMock = $this->getMockBuilder(IL10N::class)
->disableOriginalConstructor()
->getMock();
diff --git a/apps/encryption/tests/Controller/SettingsControllerTest.php b/apps/encryption/tests/Controller/SettingsControllerTest.php
index 4f3e09687e3..fcff78d77de 100644
--- a/apps/encryption/tests/Controller/SettingsControllerTest.php
+++ b/apps/encryption/tests/Controller/SettingsControllerTest.php
@@ -26,7 +26,9 @@ namespace OCA\Encryption\Tests\Controller;
use OCA\Encryption\Controller\SettingsController;
use OCA\Encryption\Session;
use OCP\AppFramework\Http;
+use OCP\IL10N;
use OCP\IRequest;
+use OCP\IUserManager;
use Test\TestCase;
class SettingsControllerTest extends TestCase {
@@ -67,7 +69,7 @@ class SettingsControllerTest extends TestCase {
$this->requestMock = $this->createMock(IRequest::class);
- $this->l10nMock = $this->getMockBuilder('OCP\IL10N')
+ $this->l10nMock = $this->getMockBuilder(IL10N::class)
->disableOriginalConstructor()->getMock();
$this->l10nMock->expects($this->any())
@@ -76,7 +78,7 @@ class SettingsControllerTest extends TestCase {
return $message;
}));
- $this->userManagerMock = $this->getMockBuilder('OCP\IUserManager')
+ $this->userManagerMock = $this->getMockBuilder(IUserManager::class)
->disableOriginalConstructor()->getMock();
$this->keyManagerMock = $this->getMockBuilder('OCA\Encryption\KeyManager')
diff --git a/apps/encryption/tests/Controller/StatusControllerTest.php b/apps/encryption/tests/Controller/StatusControllerTest.php
index ee0f7b2661c..cd3a8fdaa72 100644
--- a/apps/encryption/tests/Controller/StatusControllerTest.php
+++ b/apps/encryption/tests/Controller/StatusControllerTest.php
@@ -28,6 +28,7 @@ namespace OCA\Encryption\Tests\Controller;
use OCA\Encryption\Controller\StatusController;
use OCA\Encryption\Session;
use OCP\Encryption\IManager;
+use OCP\IL10N;
use OCP\IRequest;
use Test\TestCase;
@@ -56,7 +57,7 @@ class StatusControllerTest extends TestCase {
->disableOriginalConstructor()->getMock();
$this->requestMock = $this->createMock(IRequest::class);
- $this->l10nMock = $this->getMockBuilder('OCP\IL10N')
+ $this->l10nMock = $this->getMockBuilder(IL10N::class)
->disableOriginalConstructor()->getMock();
$this->l10nMock->expects($this->any())
->method('t')
diff --git a/apps/encryption/tests/Crypto/CryptTest.php b/apps/encryption/tests/Crypto/CryptTest.php
index 3c226ed94ab..4800be0a5ed 100644
--- a/apps/encryption/tests/Crypto/CryptTest.php
+++ b/apps/encryption/tests/Crypto/CryptTest.php
@@ -27,7 +27,9 @@ namespace OCA\Encryption\Tests\Crypto;
use OCA\Encryption\Crypto\Crypt;
+use OCP\IConfig;
use OCP\IL10N;
+use OCP\ILogger;
use Test\TestCase;
class CryptTest extends TestCase {
@@ -51,7 +53,7 @@ class CryptTest extends TestCase {
public function setUp() {
parent::setUp();
- $this->logger = $this->getMockBuilder('OCP\ILogger')
+ $this->logger = $this->getMockBuilder(ILogger::class)
->disableOriginalConstructor()
->getMock();
$this->logger->expects($this->any())
@@ -60,7 +62,7 @@ class CryptTest extends TestCase {
$this->userSession = $this->getMockBuilder('OCP\IUserSession')
->disableOriginalConstructor()
->getMock();
- $this->config = $this->getMockBuilder('OCP\IConfig')
+ $this->config = $this->getMockBuilder(IConfig::class)
->disableOriginalConstructor()
->getMock();
$this->l = $this->createMock(IL10N::class);
diff --git a/apps/encryption/tests/Crypto/EncryptAllTest.php b/apps/encryption/tests/Crypto/EncryptAllTest.php
index df8401c15b2..7d432a6d524 100644
--- a/apps/encryption/tests/Crypto/EncryptAllTest.php
+++ b/apps/encryption/tests/Crypto/EncryptAllTest.php
@@ -26,6 +26,11 @@ namespace OCA\Encryption\Tests\Crypto;
use OCA\Encryption\Crypto\EncryptAll;
+use OCP\IConfig;
+use OCP\IL10N;
+use OCP\IUserManager;
+use OCP\Mail\IMailer;
+use OCP\UserInterface;
use Symfony\Component\Console\Formatter\OutputFormatterInterface;
use Test\TestCase;
@@ -81,15 +86,15 @@ class EncryptAllTest extends TestCase {
->disableOriginalConstructor()->getMock();
$this->util = $this->getMockBuilder('OCA\Encryption\Util')
->disableOriginalConstructor()->getMock();
- $this->userManager = $this->getMockBuilder('OCP\IUserManager')
+ $this->userManager = $this->getMockBuilder(IUserManager::class)
->disableOriginalConstructor()->getMock();
$this->view = $this->getMockBuilder('OC\Files\View')
->disableOriginalConstructor()->getMock();
- $this->config = $this->getMockBuilder('OCP\IConfig')
+ $this->config = $this->getMockBuilder(IConfig::class)
->disableOriginalConstructor()->getMock();
- $this->mailer = $this->getMockBuilder('OCP\Mail\IMailer')
+ $this->mailer = $this->getMockBuilder(IMailer::class)
->disableOriginalConstructor()->getMock();
- $this->l = $this->getMockBuilder('OCP\IL10N')
+ $this->l = $this->getMockBuilder(IL10N::class)
->disableOriginalConstructor()->getMock();
$this->questionHelper = $this->getMockBuilder('Symfony\Component\Console\Helper\QuestionHelper')
->disableOriginalConstructor()->getMock();
@@ -97,7 +102,7 @@ class EncryptAllTest extends TestCase {
->disableOriginalConstructor()->getMock();
$this->outputInterface = $this->getMockBuilder('Symfony\Component\Console\Output\OutputInterface')
->disableOriginalConstructor()->getMock();
- $this->userInterface = $this->getMockBuilder('OCP\UserInterface')
+ $this->userInterface = $this->getMockBuilder(UserInterface::class)
->disableOriginalConstructor()->getMock();
diff --git a/apps/encryption/tests/Crypto/EncryptionTest.php b/apps/encryption/tests/Crypto/EncryptionTest.php
index 7e074a5b9e8..3bd4593d6bc 100644
--- a/apps/encryption/tests/Crypto/EncryptionTest.php
+++ b/apps/encryption/tests/Crypto/EncryptionTest.php
@@ -24,6 +24,8 @@
namespace OCA\Encryption\Tests\Crypto;
use OCA\Encryption\Exceptions\PublicKeyMissingException;
+use OCP\IL10N;
+use OCP\ILogger;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Test\TestCase;
@@ -84,10 +86,10 @@ class EncryptionTest extends TestCase {
$this->decryptAllMock = $this->getMockBuilder('OCA\Encryption\Crypto\DecryptAll')
->disableOriginalConstructor()
->getMock();
- $this->loggerMock = $this->getMockBuilder('OCP\ILogger')
+ $this->loggerMock = $this->getMockBuilder(ILogger::class)
->disableOriginalConstructor()
->getMock();
- $this->l10nMock = $this->getMockBuilder('OCP\IL10N')
+ $this->l10nMock = $this->getMockBuilder(IL10N::class)
->disableOriginalConstructor()
->getMock();
$this->l10nMock->expects($this->any())
diff --git a/apps/encryption/tests/Hooks/UserHooksTest.php b/apps/encryption/tests/Hooks/UserHooksTest.php
index f9477e3e038..506f46eb8e6 100644
--- a/apps/encryption/tests/Hooks/UserHooksTest.php
+++ b/apps/encryption/tests/Hooks/UserHooksTest.php
@@ -31,6 +31,7 @@ use OCA\Encryption\Crypto\Crypt;
use OCA\Encryption\Hooks\UserHooks;
use OCP\ILogger;
use OCP\IUser;
+use OCP\IUserManager;
use Test\TestCase;
/**
@@ -327,7 +328,7 @@ class UserHooksTest extends TestCase {
$this->keyManagerMock = $this->getMockBuilder('OCA\Encryption\KeyManager')
->disableOriginalConstructor()
->getMock();
- $this->userManagerMock = $this->getMockBuilder('OCP\IUserManager')
+ $this->userManagerMock = $this->getMockBuilder(IUserManager::class)
->disableOriginalConstructor()
->getMock();
$this->userSetupMock = $this->getMockBuilder('OCA\Encryption\Users\Setup')
diff --git a/apps/encryption/tests/MigrationTest.php b/apps/encryption/tests/MigrationTest.php
index 8f168e31e4d..71d2f52dd5c 100644
--- a/apps/encryption/tests/MigrationTest.php
+++ b/apps/encryption/tests/MigrationTest.php
@@ -25,6 +25,7 @@
namespace OCA\Encryption\Tests;
+use OC\Files\View;
use OCA\Encryption\Migration;
use OCP\ILogger;
@@ -68,7 +69,7 @@ class MigrationTest extends \Test\TestCase {
public function setUp() {
- $this->logger = $this->getMockBuilder('\OCP\ILogger')->disableOriginalConstructor()->getMock();
+ $this->logger = $this->getMockBuilder(ILogger::class)->disableOriginalConstructor()->getMock();
$this->view = new \OC\Files\View();
$this->moduleId = \OCA\Encryption\Crypto\Encryption::ID;
}
@@ -524,7 +525,7 @@ class MigrationTest extends \Test\TestCase {
*/
public function testGetTargetDir($user, $keyPath, $filename, $trash, $systemMounts, $expected) {
- $view = $this->getMockBuilder('\OC\Files\View')
+ $view = $this->getMockBuilder(View::class)
->disableOriginalConstructor()->getMock();
$view->expects($this->any())->method('file_exists')->willReturn(true);
diff --git a/apps/encryption/tests/Settings/AdminTest.php b/apps/encryption/tests/Settings/AdminTest.php
index 93896585dad..5fe3fe956e4 100644
--- a/apps/encryption/tests/Settings/AdminTest.php
+++ b/apps/encryption/tests/Settings/AdminTest.php
@@ -52,12 +52,12 @@ class AdminTest extends TestCase {
public function setUp() {
parent::setUp();
- $this->l = $this->getMockBuilder('\OCP\IL10N')->getMock();
- $this->logger = $this->getMockBuilder('\OCP\ILogger')->getMock();
- $this->userSession = $this->getMockBuilder('\OCP\IUserSession')->getMock();
- $this->config = $this->getMockBuilder('\OCP\IConfig')->getMock();
- $this->userManager = $this->getMockBuilder('\OCP\IUserManager')->getMock();
- $this->session = $this->getMockBuilder('\OCP\ISession')->getMock();
+ $this->l = $this->getMockBuilder(IL10N::class)->getMock();
+ $this->logger = $this->getMockBuilder(ILogger::class)->getMock();
+ $this->userSession = $this->getMockBuilder(IUserSession::class)->getMock();
+ $this->config = $this->getMockBuilder(IConfig::class)->getMock();
+ $this->userManager = $this->getMockBuilder(IUserManager::class)->getMock();
+ $this->session = $this->getMockBuilder(ISession::class)->getMock();
$this->admin = new Admin(
$this->l,