aboutsummaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2016-09-06 14:18:57 +0200
committerGitHub <noreply@github.com>2016-09-06 14:18:57 +0200
commit6a6af86a1ca14e8b803d7cd8653733842e21d25f (patch)
tree37af6b38deb4ead471847261355dc9ef72287231 /apps
parent45a84f362333e8055227ea800bf67a8ea431f3d5 (diff)
parentc609e291bd5dce6976defc0537cdf48a3cc3528b (diff)
downloadnextcloud-server-6a6af86a1ca14e8b803d7cd8653733842e21d25f.tar.gz
nextcloud-server-6a6af86a1ca14e8b803d7cd8653733842e21d25f.zip
Merge pull request #1242 from nextcloud/bump_phpunit
Bump phpunit
Diffstat (limited to 'apps')
-rw-r--r--apps/encryption/tests/Controller/SettingsControllerTest.php3
-rw-r--r--apps/encryption/tests/Controller/StatusControllerTest.php3
-rw-r--r--apps/encryption/tests/Crypto/CryptTest.php3
-rw-r--r--apps/encryption/tests/Crypto/EncryptAllTest.php3
-rw-r--r--apps/encryption/tests/Crypto/EncryptionTest.php6
-rw-r--r--apps/encryption/tests/Hooks/UserHooksTest.php6
-rw-r--r--apps/encryption/tests/KeyManagerTest.php12
-rw-r--r--apps/encryption/tests/MigrationTest.php6
-rw-r--r--apps/encryption/tests/RecoveryTest.php15
-rw-r--r--apps/encryption/tests/SessionTest.php3
-rw-r--r--apps/encryption/tests/Users/SetupTest.php3
-rw-r--r--apps/encryption/tests/UtilTest.php15
-rw-r--r--apps/files/tests/BackgroundJob/ScanFilesTest.php7
-rw-r--r--apps/files/tests/Controller/ApiControllerTest.php9
-rw-r--r--apps/files/tests/Service/TagServiceTest.php3
-rw-r--r--apps/files_external/tests/Auth/Password/GlobalAuth.php8
-rw-r--r--apps/files_external/tests/Command/ApplicableTest.php6
-rw-r--r--apps/files_external/tests/Command/ListCommandTest.php12
-rw-r--r--apps/files_external/tests/Controller/AjaxControllerTest.php15
-rw-r--r--apps/files_external/tests/Controller/GlobalStoragesControllerTest.php9
-rw-r--r--apps/files_external/tests/Controller/UserStoragesControllerTest.php12
-rw-r--r--apps/files_external/tests/Service/BackendServiceTest.php16
-rw-r--r--apps/files_external/tests/Service/StoragesServiceTest.php6
-rw-r--r--apps/files_external/tests/Service/UserGlobalStoragesServiceTest.php6
-rw-r--r--apps/files_external/tests/Service/UserStoragesServiceTest.php3
-rw-r--r--apps/files_sharing/tests/MountProviderTest.php12
-rw-r--r--apps/files_trashbin/tests/BackgroundJob/ExpireTrashTest.php6
-rw-r--r--apps/files_trashbin/tests/TrashbinTest.php2
-rw-r--r--apps/files_versions/tests/VersioningTest.php3
-rw-r--r--apps/user_ldap/tests/AccessTest.php24
-rw-r--r--apps/user_ldap/tests/ConnectionTest.php5
-rw-r--r--apps/user_ldap/tests/Group_LDAPTest.php3
-rw-r--r--apps/user_ldap/tests/Jobs/CleanUpTest.php10
-rw-r--r--apps/user_ldap/tests/Mapping/AbstractMappingTest.php4
-rw-r--r--apps/user_ldap/tests/User/ManagerTest.php27
-rw-r--r--apps/user_ldap/tests/User/UserTest.php44
-rw-r--r--apps/user_ldap/tests/User_LDAPTest.php92
-rw-r--r--apps/user_ldap/tests/WizardTest.php3
38 files changed, 267 insertions, 158 deletions
diff --git a/apps/encryption/tests/Controller/SettingsControllerTest.php b/apps/encryption/tests/Controller/SettingsControllerTest.php
index 5661ab7033f..4f3e09687e3 100644
--- a/apps/encryption/tests/Controller/SettingsControllerTest.php
+++ b/apps/encryption/tests/Controller/SettingsControllerTest.php
@@ -26,6 +26,7 @@ namespace OCA\Encryption\Tests\Controller;
use OCA\Encryption\Controller\SettingsController;
use OCA\Encryption\Session;
use OCP\AppFramework\Http;
+use OCP\IRequest;
use Test\TestCase;
class SettingsControllerTest extends TestCase {
@@ -64,7 +65,7 @@ class SettingsControllerTest extends TestCase {
parent::setUp();
- $this->requestMock = $this->getMock('OCP\IRequest');
+ $this->requestMock = $this->createMock(IRequest::class);
$this->l10nMock = $this->getMockBuilder('OCP\IL10N')
->disableOriginalConstructor()->getMock();
diff --git a/apps/encryption/tests/Controller/StatusControllerTest.php b/apps/encryption/tests/Controller/StatusControllerTest.php
index 17cec468438..c6c92e2aac2 100644
--- a/apps/encryption/tests/Controller/StatusControllerTest.php
+++ b/apps/encryption/tests/Controller/StatusControllerTest.php
@@ -27,6 +27,7 @@ namespace OCA\Encryption\Tests\Controller;
use OCA\Encryption\Controller\StatusController;
use OCA\Encryption\Session;
+use OCP\IRequest;
use Test\TestCase;
class StatusControllerTest extends TestCase {
@@ -49,7 +50,7 @@ class StatusControllerTest extends TestCase {
$this->sessionMock = $this->getMockBuilder('OCA\Encryption\Session')
->disableOriginalConstructor()->getMock();
- $this->requestMock = $this->getMock('OCP\IRequest');
+ $this->requestMock = $this->createMock(IRequest::class);
$this->l10nMock = $this->getMockBuilder('OCP\IL10N')
->disableOriginalConstructor()->getMock();
diff --git a/apps/encryption/tests/Crypto/CryptTest.php b/apps/encryption/tests/Crypto/CryptTest.php
index 7bd06471b53..b808acaf199 100644
--- a/apps/encryption/tests/Crypto/CryptTest.php
+++ b/apps/encryption/tests/Crypto/CryptTest.php
@@ -27,6 +27,7 @@ namespace OCA\Encryption\Tests\Crypto;
use OCA\Encryption\Crypto\Crypt;
+use OCP\IL10N;
use Test\TestCase;
class CryptTest extends TestCase {
@@ -62,7 +63,7 @@ class CryptTest extends TestCase {
$this->config = $this->getMockBuilder('OCP\IConfig')
->disableOriginalConstructor()
->getMock();
- $this->l = $this->getMock('OCP\IL10N');
+ $this->l = $this->createMock(IL10N::class);
$this->crypt = new Crypt($this->logger, $this->userSession, $this->config, $this->l);
}
diff --git a/apps/encryption/tests/Crypto/EncryptAllTest.php b/apps/encryption/tests/Crypto/EncryptAllTest.php
index 8232af5f9f2..6c279a54f57 100644
--- a/apps/encryption/tests/Crypto/EncryptAllTest.php
+++ b/apps/encryption/tests/Crypto/EncryptAllTest.php
@@ -26,6 +26,7 @@ namespace OCA\Encryption\Tests\Crypto;
use OCA\Encryption\Crypto\EncryptAll;
+use Symfony\Component\Console\Formatter\OutputFormatterInterface;
use Test\TestCase;
class EncryptAllTest extends TestCase {
@@ -101,7 +102,7 @@ class EncryptAllTest extends TestCase {
$this->outputInterface->expects($this->any())->method('getFormatter')
- ->willReturn($this->getMock('\Symfony\Component\Console\Formatter\OutputFormatterInterface'));
+ ->willReturn($this->createMock(OutputFormatterInterface::class));
$this->userManager->expects($this->any())->method('getBackends')->willReturn([$this->userInterface]);
$this->userInterface->expects($this->any())->method('getUsers')->willReturn(['user1', 'user2']);
diff --git a/apps/encryption/tests/Crypto/EncryptionTest.php b/apps/encryption/tests/Crypto/EncryptionTest.php
index 4d8b6bbbf2f..658f6275bb4 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 Symfony\Component\Console\Input\InputInterface;
+use Symfony\Component\Console\Output\OutputInterface;
use Test\TestCase;
use OCA\Encryption\Crypto\Encryption;
@@ -412,9 +414,9 @@ class EncryptionTest extends TestCase {
public function testPrepareDecryptAll() {
/** @var \Symfony\Component\Console\Input\InputInterface $input */
- $input = $this->getMock('Symfony\Component\Console\Input\InputInterface');
+ $input = $this->createMock(InputInterface::class);
/** @var \Symfony\Component\Console\Output\OutputInterface $output */
- $output = $this->getMock('Symfony\Component\Console\Output\OutputInterface');
+ $output = $this->createMock(OutputInterface::class);
$this->decryptAllMock->expects($this->once())->method('prepare')
->with($input, $output, 'user');
diff --git a/apps/encryption/tests/Hooks/UserHooksTest.php b/apps/encryption/tests/Hooks/UserHooksTest.php
index 6ccca3d2afa..43cc54f8901 100644
--- a/apps/encryption/tests/Hooks/UserHooksTest.php
+++ b/apps/encryption/tests/Hooks/UserHooksTest.php
@@ -29,6 +29,8 @@ namespace OCA\Encryption\Tests\Hooks;
use OCA\Encryption\Crypto\Crypt;
use OCA\Encryption\Hooks\UserHooks;
+use OCP\ILogger;
+use OCP\IUser;
use Test\TestCase;
/**
@@ -141,7 +143,7 @@ class UserHooksTest extends TestCase {
->setMethods(['setPassphrase'])
->getMock();
- $userMock = $this->getMock('OCP\IUser');
+ $userMock = $this->createMock(IUser::class);
$this->userManagerMock->expects($this->once())
->method('get')
@@ -300,7 +302,7 @@ class UserHooksTest extends TestCase {
protected function setUp() {
parent::setUp();
- $this->loggerMock = $this->getMock('OCP\ILogger');
+ $this->loggerMock = $this->createMock(ILogger::class);
$this->keyManagerMock = $this->getMockBuilder('OCA\Encryption\KeyManager')
->disableOriginalConstructor()
->getMock();
diff --git a/apps/encryption/tests/KeyManagerTest.php b/apps/encryption/tests/KeyManagerTest.php
index 9ac3befdfcb..fec311afa35 100644
--- a/apps/encryption/tests/KeyManagerTest.php
+++ b/apps/encryption/tests/KeyManagerTest.php
@@ -29,6 +29,10 @@ namespace OCA\Encryption\Tests;
use OCA\Encryption\KeyManager;
use OCA\Encryption\Session;
+use OCP\Encryption\Keys\IStorage;
+use OCP\IConfig;
+use OCP\ILogger;
+use OCP\IUserSession;
use Test\TestCase;
class KeyManagerTest extends TestCase {
@@ -69,19 +73,19 @@ class KeyManagerTest extends TestCase {
parent::setUp();
$this->userId = 'user1';
$this->systemKeyId = 'systemKeyId';
- $this->keyStorageMock = $this->getMock('OCP\Encryption\Keys\IStorage');
+ $this->keyStorageMock = $this->createMock(IStorage::class);
$this->cryptMock = $this->getMockBuilder('OCA\Encryption\Crypto\Crypt')
->disableOriginalConstructor()
->getMock();
- $this->configMock = $this->getMock('OCP\IConfig');
+ $this->configMock = $this->createMock(IConfig::class);
$this->configMock->expects($this->any())
->method('getAppValue')
->willReturn($this->systemKeyId);
- $this->userMock = $this->getMock('OCP\IUserSession');
+ $this->userMock = $this->createMock(IUserSession::class);
$this->sessionMock = $this->getMockBuilder('OCA\Encryption\Session')
->disableOriginalConstructor()
->getMock();
- $this->logMock = $this->getMock('OCP\ILogger');
+ $this->logMock = $this->createMock(ILogger::class);
$this->utilMock = $this->getMockBuilder('OCA\Encryption\Util')
->disableOriginalConstructor()
->getMock();
diff --git a/apps/encryption/tests/MigrationTest.php b/apps/encryption/tests/MigrationTest.php
index 3126dd2ff2c..0aea7543c2c 100644
--- a/apps/encryption/tests/MigrationTest.php
+++ b/apps/encryption/tests/MigrationTest.php
@@ -28,6 +28,12 @@ namespace OCA\Encryption\Tests;
use OCA\Encryption\Migration;
use OCP\ILogger;
+/**
+ * Class MigrationTest
+ *
+ * @package OCA\Encryption\Tests
+ * @group DB
+ */
class MigrationTest extends \Test\TestCase {
const TEST_ENCRYPTION_MIGRATION_USER1='test_encryption_user1';
diff --git a/apps/encryption/tests/RecoveryTest.php b/apps/encryption/tests/RecoveryTest.php
index 477913a1a69..d73b5d48c91 100644
--- a/apps/encryption/tests/RecoveryTest.php
+++ b/apps/encryption/tests/RecoveryTest.php
@@ -27,7 +27,12 @@
namespace OCA\Encryption\Tests;
+use OC\Files\View;
use OCA\Encryption\Recovery;
+use OCP\Encryption\IFile;
+use OCP\Encryption\Keys\IStorage;
+use OCP\IConfig;
+use OCP\Security\ISecureRandom;
use Test\TestCase;
class RecoveryTest extends TestCase {
@@ -268,13 +273,13 @@ class RecoveryTest extends TestCase {
$this->cryptMock = $this->getMockBuilder('OCA\Encryption\Crypto\Crypt')->disableOriginalConstructor()->getMock();
/** @var \OCP\Security\ISecureRandom $randomMock */
- $randomMock = $this->getMock('OCP\Security\ISecureRandom');
+ $randomMock = $this->createMock(ISecureRandom::class);
$this->keyManagerMock = $this->getMockBuilder('OCA\Encryption\KeyManager')->disableOriginalConstructor()->getMock();
- $this->configMock = $this->getMock('OCP\IConfig');
+ $this->configMock = $this->createMock(IConfig::class);
/** @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');
+ $keyStorageMock = $this->createMock(IStorage::class);
+ $this->fileMock = $this->createMock(IFile::class);
+ $this->viewMock = $this->createMock(View::class);
$this->configMock->expects($this->any())
->method('setAppValue')
diff --git a/apps/encryption/tests/SessionTest.php b/apps/encryption/tests/SessionTest.php
index 1a22726f5b1..099acddbca1 100644
--- a/apps/encryption/tests/SessionTest.php
+++ b/apps/encryption/tests/SessionTest.php
@@ -28,6 +28,7 @@ namespace OCA\Encryption\Tests;
use OCA\Encryption\Session;
+use OCP\ISession;
use Test\TestCase;
class SessionTest extends TestCase {
@@ -175,7 +176,7 @@ class SessionTest extends TestCase {
*/
protected function setUp() {
parent::setUp();
- $this->sessionMock = $this->getMock('OCP\ISession');
+ $this->sessionMock = $this->createMock(ISession::class);
$this->sessionMock->expects($this->any())
->method('set')
diff --git a/apps/encryption/tests/Users/SetupTest.php b/apps/encryption/tests/Users/SetupTest.php
index 252092f9e5e..9e856861046 100644
--- a/apps/encryption/tests/Users/SetupTest.php
+++ b/apps/encryption/tests/Users/SetupTest.php
@@ -27,6 +27,7 @@ namespace OCA\Encryption\Tests\Users;
use OCA\Encryption\Users\Setup;
+use OCP\ILogger;
use Test\TestCase;
class SetupTest extends TestCase {
@@ -45,7 +46,7 @@ class SetupTest extends TestCase {
protected function setUp() {
parent::setUp();
- $logMock = $this->getMock('OCP\ILogger');
+ $logMock = $this->createMock(ILogger::class);
$userSessionMock = $this->getMockBuilder('OCP\IUserSession')
->disableOriginalConstructor()
->getMock();
diff --git a/apps/encryption/tests/UtilTest.php b/apps/encryption/tests/UtilTest.php
index 84a9ad493d7..d2f1d40e16d 100644
--- a/apps/encryption/tests/UtilTest.php
+++ b/apps/encryption/tests/UtilTest.php
@@ -26,7 +26,12 @@
namespace OCA\Encryption\Tests;
+use OC\Files\View;
use OCA\Encryption\Util;
+use OCP\Files\Mount\IMountPoint;
+use OCP\IConfig;
+use OCP\ILogger;
+use OCP\IUserManager;
use Test\TestCase;
class UtilTest extends TestCase {
@@ -70,16 +75,16 @@ class UtilTest extends TestCase {
protected function setUp() {
parent::setUp();
- $this->mountMock = $this->getMock('\OCP\Files\Mount\IMountPoint');
- $this->filesMock = $this->getMock('OC\Files\View');
- $this->userManagerMock = $this->getMock('\OCP\IUserManager');
+ $this->mountMock = $this->createMock(IMountPoint::class);
+ $this->filesMock = $this->createMock(View::class);
+ $this->userManagerMock = $this->createMock(IUserManager::class);
/** @var \OCA\Encryption\Crypto\Crypt $cryptMock */
$cryptMock = $this->getMockBuilder('OCA\Encryption\Crypto\Crypt')
->disableOriginalConstructor()
->getMock();
/** @var \OCP\ILogger $loggerMock */
- $loggerMock = $this->getMock('OCP\ILogger');
+ $loggerMock = $this->createMock(ILogger::class);
/** @var \OCP\IUserSession|\PHPUnit_Framework_MockObject_MockObject $userSessionMock */
$userSessionMock = $this->getMockBuilder('OCP\IUserSession')
->disableOriginalConstructor()
@@ -102,7 +107,7 @@ class UtilTest extends TestCase {
->will($this->returnSelf());
- $this->configMock = $this->getMock('OCP\IConfig');
+ $this->configMock = $this->createMock(IConfig::class);
$this->configMock->expects($this->any())
->method('getUserValue')
diff --git a/apps/files/tests/BackgroundJob/ScanFilesTest.php b/apps/files/tests/BackgroundJob/ScanFilesTest.php
index 16bf1d793b7..877c3bafd6d 100644
--- a/apps/files/tests/BackgroundJob/ScanFilesTest.php
+++ b/apps/files/tests/BackgroundJob/ScanFilesTest.php
@@ -21,6 +21,7 @@
*/
namespace OCA\Files\Tests\BackgroundJob;
+use OCP\IUser;
use Test\TestCase;
use OCP\IConfig;
use OCP\IUserManager;
@@ -42,8 +43,8 @@ class ScanFilesTest extends TestCase {
public function setUp() {
parent::setUp();
- $this->config = $this->getMock('\OCP\IConfig');
- $this->userManager = $this->getMock('\OCP\IUserManager');
+ $this->config = $this->createMock(IConfig::class);
+ $this->userManager = $this->createMock(IUserManager::class);
$this->scanFiles = $this->getMockBuilder('\OCA\Files\BackgroundJob\ScanFiles')
->setConstructorArgs([
@@ -79,7 +80,7 @@ class ScanFilesTest extends TestCase {
}
public function testRunWithUsers() {
- $fakeUser = $this->getMock('\OCP\IUser');
+ $fakeUser = $this->createMock(IUser::class);
$this->config
->expects($this->at(0))
->method('getAppValue')
diff --git a/apps/files/tests/Controller/ApiControllerTest.php b/apps/files/tests/Controller/ApiControllerTest.php
index 348150e0e08..9bfc6d6f5e8 100644
--- a/apps/files/tests/Controller/ApiControllerTest.php
+++ b/apps/files/tests/Controller/ApiControllerTest.php
@@ -30,6 +30,9 @@ use OC\Files\FileInfo;
use OCP\AppFramework\Http;
use OCP\Files\NotFoundException;
use OCP\Files\StorageNotAvailableException;
+use OCP\IConfig;
+use OCP\IUser;
+use OCP\IUserSession;
use Test\TestCase;
use OCP\IRequest;
use OCA\Files\Service\TagService;
@@ -66,11 +69,11 @@ class ApiControllerTest extends TestCase {
$this->request = $this->getMockBuilder('\OCP\IRequest')
->disableOriginalConstructor()
->getMock();
- $this->user = $this->getMock('\OCP\IUser');
+ $this->user = $this->createMock(IUser::class);
$this->user->expects($this->any())
->method('getUID')
->will($this->returnValue('user1'));
- $userSession = $this->getMock('\OCP\IUserSession');
+ $userSession = $this->createMock(IUserSession::class);
$userSession->expects($this->any())
->method('getUser')
->will($this->returnValue($this->user));
@@ -83,7 +86,7 @@ class ApiControllerTest extends TestCase {
$this->preview = $this->getMockBuilder('\OCP\IPreview')
->disableOriginalConstructor()
->getMock();
- $this->config = $this->getMock('\OCP\IConfig');
+ $this->config = $this->createMock(IConfig::class);
$this->userFolder = $this->getMockBuilder('\OC\Files\Node\Folder')
->disableOriginalConstructor()
->getMock();
diff --git a/apps/files/tests/Service/TagServiceTest.php b/apps/files/tests/Service/TagServiceTest.php
index 388c9c28fa1..b8d36487585 100644
--- a/apps/files/tests/Service/TagServiceTest.php
+++ b/apps/files/tests/Service/TagServiceTest.php
@@ -25,6 +25,7 @@
namespace OCA\Files\Tests\Service;
use OCA\Files\Service\TagService;
+use OCP\IUserSession;
/**
* Class TagServiceTest
@@ -66,7 +67,7 @@ class TagServiceTest extends \Test\TestCase {
/**
* @var \OCP\IUserSession
*/
- $userSession = $this->getMock('\OCP\IUserSession');
+ $userSession = $this->createMock(IUserSession::class);
$userSession->expects($this->any())
->method('getUser')
->withAnyParameters()
diff --git a/apps/files_external/tests/Auth/Password/GlobalAuth.php b/apps/files_external/tests/Auth/Password/GlobalAuth.php
index 1f0841a3493..405fbd2941c 100644
--- a/apps/files_external/tests/Auth/Password/GlobalAuth.php
+++ b/apps/files_external/tests/Auth/Password/GlobalAuth.php
@@ -24,6 +24,8 @@ namespace OCA\Files_External\Tests\Auth\Password;
use OCA\Files_External\Lib\Auth\Password\GlobalAuth;
use OCA\Files_external\Lib\StorageConfig;
+use OCP\IL10N;
+use OCP\Security\ICredentialsManager;
use Test\TestCase;
class GlobalAuthTest extends TestCase {
@@ -44,14 +46,14 @@ class GlobalAuthTest extends TestCase {
protected function setUp() {
parent::setUp();
- $this->l10n = $this->getMock('\OCP\IL10N');
- $this->credentialsManager = $this->getMock('\OCP\Security\ICredentialsManager');
+ $this->l10n = $this->createMock(IL10N::class);
+ $this->credentialsManager = $this->createMock(ICredentialsManager::class);
$this->instance = new GlobalAuth($this->l10n, $this->credentialsManager);
}
private function getStorageConfig($type, $config = []) {
/** @var \OCA\Files_External\Lib\StorageConfig|\PHPUnit_Framework_MockObject_MockObject $storageConfig */
- $storageConfig = $this->getMock('\OCA\Files_External\Lib\StorageConfig');
+ $storageConfig = $this->createMock(StorageConfig::class);
$storageConfig->expects($this->any())
->method('getType')
->will($this->returnValue($type));
diff --git a/apps/files_external/tests/Command/ApplicableTest.php b/apps/files_external/tests/Command/ApplicableTest.php
index 7e2ba9563a2..70b18be6b7b 100644
--- a/apps/files_external/tests/Command/ApplicableTest.php
+++ b/apps/files_external/tests/Command/ApplicableTest.php
@@ -23,13 +23,15 @@
namespace OCA\Files_External\Tests\Command;
use OCA\Files_External\Command\Applicable;
+use OCP\IGroupManager;
+use OCP\IUserManager;
class ApplicableTest extends CommandTest {
private function getInstance($storageService) {
/** @var \OCP\IUserManager|\PHPUnit_Framework_MockObject_MockObject $userManager */
- $userManager = $this->getMock('\OCP\IUserManager');
+ $userManager = $this->createMock(IUserManager::class);
/** @var \OCP\IGroupManager|\PHPUnit_Framework_MockObject_MockObject $groupManager */
- $groupManager = $this->getMock('\OCP\IGroupManager');
+ $groupManager = $this->createMock(IGroupManager::class);
$userManager->expects($this->any())
->method('userExists')
diff --git a/apps/files_external/tests/Command/ListCommandTest.php b/apps/files_external/tests/Command/ListCommandTest.php
index 256b35d8883..7caf61cf57c 100644
--- a/apps/files_external/tests/Command/ListCommandTest.php
+++ b/apps/files_external/tests/Command/ListCommandTest.php
@@ -29,6 +29,10 @@ use OCA\Files_External\Lib\Auth\Password\Password;
use OCA\Files_External\Lib\Auth\Password\SessionCredentials;
use OCA\Files_External\Lib\Backend\Local;
use OCA\Files_External\Lib\StorageConfig;
+use OCP\ISession;
+use OCP\IUserManager;
+use OCP\IUserSession;
+use OCP\Security\ICrypto;
use Symfony\Component\Console\Output\BufferedOutput;
class ListCommandTest extends CommandTest {
@@ -41,17 +45,17 @@ class ListCommandTest extends CommandTest {
/** @var \OCA\Files_External\Service\UserStoragesService|\PHPUnit_Framework_MockObject_MockObject $userService */
$userService = $this->getMock('\OCA\Files_External\Service\UserStoragesService', null, [], '', false);
/** @var \OCP\IUserManager|\PHPUnit_Framework_MockObject_MockObject $userManager */
- $userManager = $this->getMock('\OCP\IUserManager');
+ $userManager = $this->createMock(IUserManager::class);
/** @var \OCP\IUserSession|\PHPUnit_Framework_MockObject_MockObject $userSession */
- $userSession = $this->getMock('\OCP\IUserSession');
+ $userSession = $this->createMock(IUserSession::class);
return new ListCommand($globalService, $userService, $userSession, $userManager);
}
public function testListAuthIdentifier() {
$l10n = $this->getMock('\OC_L10N', null, [], '', false);
- $session = $this->getMock('\OCP\ISession');
- $crypto = $this->getMock('\OCP\Security\ICrypto');
+ $session = $this->createMock(ISession::class);
+ $crypto = $this->createMock(ICrypto::class);
$instance = $this->getInstance();
$mount1 = new StorageConfig();
$mount1->setAuthMechanism(new Password($l10n));
diff --git a/apps/files_external/tests/Controller/AjaxControllerTest.php b/apps/files_external/tests/Controller/AjaxControllerTest.php
index 0fcd89611cf..8aba70e0d6b 100644
--- a/apps/files_external/tests/Controller/AjaxControllerTest.php
+++ b/apps/files_external/tests/Controller/AjaxControllerTest.php
@@ -28,6 +28,7 @@ use OCA\Files_External\Lib\Auth\PublicKey\RSA;
use OCP\AppFramework\Http\JSONResponse;
use OCP\IGroupManager;
use OCP\IRequest;
+use OCP\IUser;
use OCP\IUserSession;
use Test\TestCase;
@@ -46,15 +47,15 @@ class AjaxControllerTest extends TestCase {
private $ajaxController;
public function setUp() {
- $this->request = $this->getMock('\\OCP\\IRequest');
+ $this->request = $this->createMock(IRequest::class);
$this->rsa = $this->getMockBuilder('\\OCA\\Files_External\\Lib\\Auth\\PublicKey\\RSA')
->disableOriginalConstructor()
->getMock();
$this->globalAuth = $this->getMockBuilder('\\OCA\\Files_External\\Lib\\Auth\\Password\GlobalAuth')
->disableOriginalConstructor()
->getMock();
- $this->userSession = $this->getMock('\\OCP\\IUserSession');
- $this->groupManager = $this->getMock('\\OCP\\IGroupManager');
+ $this->userSession = $this->createMock(IUserSession::class);
+ $this->groupManager = $this->createMock(IGroupManager::class);
$this->ajaxController = new AjaxController(
'files_external',
@@ -90,7 +91,7 @@ class AjaxControllerTest extends TestCase {
}
public function testSaveGlobalCredentialsAsAdminForAnotherUser() {
- $user = $this->getMock('\\OCP\\IUser');
+ $user = $this->createMock(IUser::class);
$user
->expects($this->once())
->method('getUID')
@@ -113,7 +114,7 @@ class AjaxControllerTest extends TestCase {
}
public function testSaveGlobalCredentialsAsAdminForSelf() {
- $user = $this->getMock('\\OCP\\IUser');
+ $user = $this->createMock(IUser::class);
$user
->expects($this->once())
->method('getUID')
@@ -136,7 +137,7 @@ class AjaxControllerTest extends TestCase {
}
public function testSaveGlobalCredentialsAsNormalUserForSelf() {
- $user = $this->getMock('\\OCP\\IUser');
+ $user = $this->createMock(IUser::class);
$user
->expects($this->exactly(2))
->method('getUID')
@@ -159,7 +160,7 @@ class AjaxControllerTest extends TestCase {
}
public function testSaveGlobalCredentialsAsNormalUserForAnotherUser() {
- $user = $this->getMock('\\OCP\\IUser');
+ $user = $this->createMock(IUser::class);
$user
->expects($this->exactly(2))
->method('getUID')
diff --git a/apps/files_external/tests/Controller/GlobalStoragesControllerTest.php b/apps/files_external/tests/Controller/GlobalStoragesControllerTest.php
index 627892613ec..5c334efdf4c 100644
--- a/apps/files_external/tests/Controller/GlobalStoragesControllerTest.php
+++ b/apps/files_external/tests/Controller/GlobalStoragesControllerTest.php
@@ -27,6 +27,9 @@ namespace OCA\Files_External\Tests\Controller;
use OCA\Files_External\Controller\GlobalStoragesController;
use \OCP\AppFramework\Http;
use \OCA\Files_External\Service\BackendService;
+use OCP\IL10N;
+use OCP\ILogger;
+use OCP\IRequest;
class GlobalStoragesControllerTest extends StoragesControllerTest {
public function setUp() {
@@ -40,10 +43,10 @@ class GlobalStoragesControllerTest extends StoragesControllerTest {
$this->controller = new GlobalStoragesController(
'files_external',
- $this->getMock('\OCP\IRequest'),
- $this->getMock('\OCP\IL10N'),
+ $this->createMock(IRequest::class),
+ $this->createMock(IL10N::class),
$this->service,
- $this->getMock('\OCP\ILogger')
+ $this->createMock(ILogger::class)
);
}
}
diff --git a/apps/files_external/tests/Controller/UserStoragesControllerTest.php b/apps/files_external/tests/Controller/UserStoragesControllerTest.php
index 36182505bf6..cdfcbcd1407 100644
--- a/apps/files_external/tests/Controller/UserStoragesControllerTest.php
+++ b/apps/files_external/tests/Controller/UserStoragesControllerTest.php
@@ -28,6 +28,10 @@ use \OCA\Files_External\Controller\UserStoragesController;
use OCA\Files_External\Lib\StorageConfig;
use \OCP\AppFramework\Http;
use \OCA\Files_External\Service\BackendService;
+use OCP\IL10N;
+use OCP\ILogger;
+use OCP\IRequest;
+use OCP\IUserSession;
class UserStoragesControllerTest extends StoragesControllerTest {
@@ -47,11 +51,11 @@ class UserStoragesControllerTest extends StoragesControllerTest {
$this->controller = new UserStoragesController(
'files_external',
- $this->getMock('\OCP\IRequest'),
- $this->getMock('\OCP\IL10N'),
+ $this->createMock(IRequest::class),
+ $this->createMock(IL10N::class),
$this->service,
- $this->getMock('\OCP\IUserSession'),
- $this->getMock('\OCP\ILogger')
+ $this->createMock(IUserSession::class),
+ $this->createMock(ILogger::class)
);
}
diff --git a/apps/files_external/tests/Service/BackendServiceTest.php b/apps/files_external/tests/Service/BackendServiceTest.php
index efc0a32af5a..cbb25579e11 100644
--- a/apps/files_external/tests/Service/BackendServiceTest.php
+++ b/apps/files_external/tests/Service/BackendServiceTest.php
@@ -21,7 +21,11 @@
*/
namespace OCA\Files_External\Tests\Service;
+use OCA\Files_External\Lib\Config\IAuthMechanismProvider;
+use OCA\Files_External\Lib\Config\IBackendProvider;
use \OCA\Files_External\Service\BackendService;
+use OCP\IConfig;
+use OCP\IL10N;
class BackendServiceTest extends \Test\TestCase {
@@ -32,8 +36,8 @@ class BackendServiceTest extends \Test\TestCase {
protected $l10n;
protected function setUp() {
- $this->config = $this->getMock('\OCP\IConfig');
- $this->l10n = $this->getMock('\OCP\IL10N');
+ $this->config = $this->createMock(IConfig::class);
+ $this->l10n = $this->createMock(IL10N::class);
}
/**
@@ -97,7 +101,7 @@ class BackendServiceTest extends \Test\TestCase {
$backend1 = $this->getBackendMock('\Foo\Bar');
$backend2 = $this->getBackendMock('\Bar\Foo');
- $providerMock = $this->getMock('\OCA\Files_External\Lib\Config\IBackendProvider');
+ $providerMock = $this->createMock(IBackendProvider::class);
$providerMock->expects($this->once())
->method('getBackends')
->willReturn([$backend1, $backend2]);
@@ -115,7 +119,7 @@ class BackendServiceTest extends \Test\TestCase {
$backend1 = $this->getAuthMechanismMock('\Foo\Bar');
$backend2 = $this->getAuthMechanismMock('\Bar\Foo');
- $providerMock = $this->getMock('\OCA\Files_External\Lib\Config\IAuthMechanismProvider');
+ $providerMock = $this->createMock(IAuthMechanismProvider::class);
$providerMock->expects($this->once())
->method('getAuthMechanisms')
->willReturn([$backend1, $backend2]);
@@ -135,12 +139,12 @@ class BackendServiceTest extends \Test\TestCase {
$backend2 = $this->getBackendMock('\Dead\Beef');
- $provider1Mock = $this->getMock('\OCA\Files_External\Lib\Config\IBackendProvider');
+ $provider1Mock = $this->createMock(IBackendProvider::class);
$provider1Mock->expects($this->once())
->method('getBackends')
->willReturn([$backend1a, $backend1b]);
$service->registerBackendProvider($provider1Mock);
- $provider2Mock = $this->getMock('\OCA\Files_External\Lib\Config\IBackendProvider');
+ $provider2Mock = $this->createMock(IBackendProvider::class);
$provider2Mock->expects($this->once())
->method('getBackends')
->willReturn([$backend2]);
diff --git a/apps/files_external/tests/Service/StoragesServiceTest.php b/apps/files_external/tests/Service/StoragesServiceTest.php
index 5dcd93c8ae0..2776f24d5ab 100644
--- a/apps/files_external/tests/Service/StoragesServiceTest.php
+++ b/apps/files_external/tests/Service/StoragesServiceTest.php
@@ -31,6 +31,8 @@ use OCA\Files_External\Lib\StorageConfig;
use OCA\Files_External\Service\BackendService;
use OCA\Files_External\Service\DBConfigService;
use OCA\Files_External\Service\StoragesService;
+use OCP\AppFramework\IAppContainer;
+use OCP\Files\Config\IUserMountCache;
class CleaningDBConfig extends DBConfigService {
private $mountIds = [];
@@ -94,7 +96,7 @@ abstract class StoragesServiceTest extends \Test\TestCase {
);
\OC_Mount_Config::$skipTest = true;
- $this->mountCache = $this->getMock('OCP\Files\Config\IUserMountCache');
+ $this->mountCache = $this->createMock(IUserMountCache::class);
// prepare BackendService mock
$this->backendService =
@@ -150,7 +152,7 @@ abstract class StoragesServiceTest extends \Test\TestCase {
Filesystem::signal_delete_mount,
get_class($this), 'deleteHookCallback');
- $containerMock = $this->getMock('\OCP\AppFramework\IAppContainer');
+ $containerMock = $this->createMock(IAppContainer::class);
$containerMock->method('query')
->will($this->returnCallback(function ($name) {
if ($name === 'OCA\Files_External\Service\BackendService') {
diff --git a/apps/files_external/tests/Service/UserGlobalStoragesServiceTest.php b/apps/files_external/tests/Service/UserGlobalStoragesServiceTest.php
index 6d4aa922c72..72e5dc15147 100644
--- a/apps/files_external/tests/Service/UserGlobalStoragesServiceTest.php
+++ b/apps/files_external/tests/Service/UserGlobalStoragesServiceTest.php
@@ -28,7 +28,9 @@ use OCA\Files_External\Lib\StorageConfig;
use OCA\Files_External\NotFoundException;
use OCA\Files_External\Service\StoragesService;
use OCA\Files_External\Service\UserGlobalStoragesService;
+use OCP\IGroupManager;
use OCP\IUser;
+use OCP\IUserSession;
use Test\Traits\UserTrait;
/**
@@ -63,13 +65,13 @@ class UserGlobalStoragesServiceTest extends GlobalStoragesServiceTest {
$this->user = new \OC\User\User(self::USER_ID, null);
/** @var \OCP\IUserSession|\PHPUnit_Framework_MockObject_MockObject $userSession */
- $userSession = $this->getMock('\OCP\IUserSession');
+ $userSession = $this->createMock(IUserSession::class);
$userSession
->expects($this->any())
->method('getUser')
->will($this->returnValue($this->user));
- $this->groupManager = $this->getMock('\OCP\IGroupManager');
+ $this->groupManager = $this->createMock(IGroupManager::class);
$this->groupManager->method('isInGroup')
->will($this->returnCallback(function ($userId, $groupId) {
if ($userId === self::USER_ID) {
diff --git a/apps/files_external/tests/Service/UserStoragesServiceTest.php b/apps/files_external/tests/Service/UserStoragesServiceTest.php
index 85338065c73..3a820f644b4 100644
--- a/apps/files_external/tests/Service/UserStoragesServiceTest.php
+++ b/apps/files_external/tests/Service/UserStoragesServiceTest.php
@@ -30,6 +30,7 @@ use OCA\Files_External\Service\GlobalStoragesService;
use OCA\Files_External\Service\StoragesService;
use OCA\Files_External\Service\UserStoragesService;
use OCA\Files_External\Lib\StorageConfig;
+use OCP\IUserSession;
use Test\Traits\UserTrait;
/**
@@ -57,7 +58,7 @@ class UserStoragesServiceTest extends StoragesServiceTest {
$this->user = \OC::$server->getUserManager()->get($this->userId);
/** @var \OCP\IUserSession|\PHPUnit_Framework_MockObject_MockObject $userSession */
- $userSession = $this->getMock('\OCP\IUserSession');
+ $userSession = $this->createMock(IUserSession::class);
$userSession
->expects($this->any())
->method('getUser')
diff --git a/apps/files_sharing/tests/MountProviderTest.php b/apps/files_sharing/tests/MountProviderTest.php
index 576f05d565d..0be74a645a9 100644
--- a/apps/files_sharing/tests/MountProviderTest.php
+++ b/apps/files_sharing/tests/MountProviderTest.php
@@ -25,10 +25,12 @@
namespace OCA\Files_Sharing\Tests;
use OCA\Files_Sharing\MountProvider;
+use OCP\Files\IRootFolder;
use OCP\Files\Storage\IStorageFactory;
use OCP\IConfig;
use OCP\ILogger;
use OCP\IUser;
+use OCP\IUserManager;
use OCP\Share\IShare;
use OCP\Share\IManager;
use OCP\Files\Mount\IMountPoint;
@@ -69,7 +71,7 @@ class MountProviderTest extends \Test\TestCase {
}
private function makeMockShare($id, $nodeId, $owner = 'user2', $target = null, $permissions = 31) {
- $share = $this->getMock('\OCP\Share\IShare');
+ $share = $this->createMock(IShare::class);
$share->expects($this->any())
->method('getPermissions')
->will($this->returnValue($permissions));
@@ -100,8 +102,8 @@ class MountProviderTest extends \Test\TestCase {
* - shares with a group in which the owner is already in
*/
public function testExcludeShares() {
- $rootFolder = $this->getMock('\OCP\Files\IRootFolder');
- $userManager = $this->getMock('\OCP\IUserManager');
+ $rootFolder = $this->createMock(IRootFolder::class);
+ $userManager = $this->createMock(IUserManager::class);
$userShares = [
$this->makeMockShare(1, 100, 'user2', '/share2', 0),
$this->makeMockShare(2, 100, 'user2', '/share2', 31),
@@ -277,8 +279,8 @@ class MountProviderTest extends \Test\TestCase {
* @param array $expectedShares array of expected supershare specs
*/
public function testMergeShares($userShares, $groupShares, $expectedShares) {
- $rootFolder = $this->getMock('\OCP\Files\IRootFolder');
- $userManager = $this->getMock('\OCP\IUserManager');
+ $rootFolder = $this->createMock(IRootFolder::class);
+ $userManager = $this->createMock(IUserManager::class);
$userShares = array_map(function($shareSpec) {
return $this->makeMockShare($shareSpec[0], $shareSpec[1], $shareSpec[2], $shareSpec[3], $shareSpec[4]);
diff --git a/apps/files_trashbin/tests/BackgroundJob/ExpireTrashTest.php b/apps/files_trashbin/tests/BackgroundJob/ExpireTrashTest.php
index d92984bbce9..4bf533194b4 100644
--- a/apps/files_trashbin/tests/BackgroundJob/ExpireTrashTest.php
+++ b/apps/files_trashbin/tests/BackgroundJob/ExpireTrashTest.php
@@ -24,15 +24,17 @@
namespace OCA\Files_Trashbin\Tests\BackgroundJob;
use \OCA\Files_Trashbin\BackgroundJob\ExpireTrash;
+use OCP\BackgroundJob\IJobList;
+use OCP\IUserManager;
class ExpireTrashTest extends \Test\TestCase {
public function testConstructAndRun() {
$backgroundJob = new ExpireTrash(
- $this->getMock('OCP\IUserManager'),
+ $this->createMock(IUserManager::class),
$this->getMockBuilder('OCA\Files_Trashbin\Expiration')->disableOriginalConstructor()->getMock()
);
- $jobList = $this->getMock('\OCP\BackgroundJob\IJobList');
+ $jobList = $this->createMock(IJobList::class);
/** @var \OC\BackgroundJob\JobList $jobList */
$backgroundJob->execute($jobList);
diff --git a/apps/files_trashbin/tests/TrashbinTest.php b/apps/files_trashbin/tests/TrashbinTest.php
index cb5a9fed5bb..7e4cdb112e8 100644
--- a/apps/files_trashbin/tests/TrashbinTest.php
+++ b/apps/files_trashbin/tests/TrashbinTest.php
@@ -112,7 +112,7 @@ class TrashbinTest extends \Test\TestCase {
\OC::$server->getAppManager()->enableApp('files_trashbin');
$config = \OC::$server->getConfig();
- $mockConfig = $this->getMock('\OCP\IConfig');
+ $mockConfig = $this->createMock(\OCP\IConfig::class);
$mockConfig->expects($this->any())
->method('getSystemValue')
->will($this->returnCallback(function ($key, $default) use ($config) {
diff --git a/apps/files_versions/tests/VersioningTest.php b/apps/files_versions/tests/VersioningTest.php
index 15bcaf9a90c..6e6551089cc 100644
--- a/apps/files_versions/tests/VersioningTest.php
+++ b/apps/files_versions/tests/VersioningTest.php
@@ -36,6 +36,7 @@ namespace OCA\Files_Versions\Tests;
require_once __DIR__ . '/../appinfo/app.php';
use OC\Files\Storage\Temporary;
+use OCP\IConfig;
/**
* Class Test_Files_versions
@@ -79,7 +80,7 @@ class VersioningTest extends \Test\TestCase {
parent::setUp();
$config = \OC::$server->getConfig();
- $mockConfig = $this->getMock('\OCP\IConfig');
+ $mockConfig = $this->createMock(IConfig::class);
$mockConfig->expects($this->any())
->method('getSystemValue')
->will($this->returnCallback(function ($key, $default) use ($config) {
diff --git a/apps/user_ldap/tests/AccessTest.php b/apps/user_ldap/tests/AccessTest.php
index 5e99583c70f..08e7c9f79f5 100644
--- a/apps/user_ldap/tests/AccessTest.php
+++ b/apps/user_ldap/tests/AccessTest.php
@@ -28,6 +28,14 @@ namespace OCA\User_LDAP\Tests;
use OCA\User_LDAP\Access;
use OCA\User_LDAP\Connection;
+use OCA\User_LDAP\FilesystemHelper;
+use OCA\User_LDAP\ILDAPWrapper;
+use OCA\User_LDAP\LogWrapper;
+use OCP\IAvatarManager;
+use OCP\IConfig;
+use OCP\IDBConnection;
+use OCP\Image;
+use OCP\IUserManager;
/**
* Class AccessTest
@@ -47,19 +55,19 @@ class AccessTest extends \Test\TestCase {
$accMethods = get_class_methods('\OCA\User_LDAP\Access');
$umMethods = get_class_methods('\OCA\User_LDAP\User\Manager');
}
- $lw = $this->getMock('\OCA\User_LDAP\ILDAPWrapper');
+ $lw = $this->createMock(ILDAPWrapper::class);
$connector = $this->getMock('\OCA\User_LDAP\Connection',
$conMethods,
array($lw, null, null));
$um = $this->getMock('\OCA\User_LDAP\User\Manager',
$umMethods, array(
- $this->getMock('\OCP\IConfig'),
- $this->getMock('\OCA\User_LDAP\FilesystemHelper'),
- $this->getMock('\OCA\User_LDAP\LogWrapper'),
- $this->getMock('\OCP\IAvatarManager'),
- $this->getMock('\OCP\Image'),
- $this->getMock('\OCP\IDBConnection'),
- $this->getMock('\OCP\IUserManager')));
+ $this->createMock(IConfig::class),
+ $this->createMock(FilesystemHelper::class),
+ $this->createMock(LogWrapper::class),
+ $this->createMock(IAvatarManager::class),
+ $this->createMock(Image::class),
+ $this->createMock(IDBConnection::class),
+ $this->createMock(IUserManager::class)));
$helper = new \OCA\User_LDAP\Helper();
return array($lw, $connector, $um, $helper);
diff --git a/apps/user_ldap/tests/ConnectionTest.php b/apps/user_ldap/tests/ConnectionTest.php
index ed0a1481589..fcff65efb33 100644
--- a/apps/user_ldap/tests/ConnectionTest.php
+++ b/apps/user_ldap/tests/ConnectionTest.php
@@ -25,6 +25,7 @@
namespace OCA\User_LDAP\Tests;
use OCA\User_LDAP\Connection;
+use OCA\User_LDAP\ILDAPWrapper;
/**
* Class Test_Connection
@@ -43,7 +44,7 @@ class ConnectionTest extends \Test\TestCase {
public function setUp() {
parent::setUp();
- $this->ldap = $this->getMock('\OCA\User_LDAP\ILDAPWrapper');
+ $this->ldap = $this->createMock(ILDAPWrapper::class);
// we use a mock here to replace the cache mechanism, due to missing DI in LDAP backend.
$this->connection = $this->getMockBuilder('OCA\User_LDAP\Connection')
->setMethods(['getFromCache', 'writeToCache'])
@@ -59,7 +60,7 @@ class ConnectionTest extends \Test\TestCase {
//background: upon login a bind is done with the user credentials
//which is valid for the whole LDAP resource. It needs to be reset
//to the agent's credentials
- $lw = $this->getMock('\OCA\User_LDAP\ILDAPWrapper');
+ $lw = $this->createMock(ILDAPWrapper::class);
$connection = new Connection($lw, '', null);
$agent = array(
diff --git a/apps/user_ldap/tests/Group_LDAPTest.php b/apps/user_ldap/tests/Group_LDAPTest.php
index 83ec2dedf22..12f7eaa2256 100644
--- a/apps/user_ldap/tests/Group_LDAPTest.php
+++ b/apps/user_ldap/tests/Group_LDAPTest.php
@@ -31,6 +31,7 @@ namespace OCA\User_LDAP\Tests;
use OCA\User_LDAP\Group_LDAP as GroupLDAP;
use OCA\User_LDAP\Access;
use OCA\User_LDAP\Connection;
+use OCA\User_LDAP\ILDAPWrapper;
/**
* Class GroupLDAPTest
@@ -48,7 +49,7 @@ class Group_LDAPTest extends \Test\TestCase {
$conMethods = get_class_methods('\OCA\User_LDAP\Connection');
$accMethods = get_class_methods('\OCA\User_LDAP\Access');
}
- $lw = $this->getMock('\OCA\User_LDAP\ILDAPWrapper');
+ $lw = $this->createMock(ILDAPWrapper::class);
$connector = $this->getMock('\OCA\User_LDAP\Connection',
$conMethods,
array($lw, null, null));
diff --git a/apps/user_ldap/tests/Jobs/CleanUpTest.php b/apps/user_ldap/tests/Jobs/CleanUpTest.php
index 45e7998da01..62cebcf328e 100644
--- a/apps/user_ldap/tests/Jobs/CleanUpTest.php
+++ b/apps/user_ldap/tests/Jobs/CleanUpTest.php
@@ -24,6 +24,10 @@
namespace OCA\User_LDAP\Tests\Jobs;
+use OCA\User_LDAP\Helper;
+use OCP\IConfig;
+use OCP\IDBConnection;
+
class CleanUpTest extends \Test\TestCase {
public function getMocks() {
$mocks = array();
@@ -35,9 +39,9 @@ class CleanUpTest extends \Test\TestCase {
$this->getMockBuilder('\OCA\User_LDAP\User\DeletedUsersIndex')
->disableOriginalConstructor()
->getMock();
- $mocks['ocConfig'] = $this->getMock('\OCP\IConfig');
- $mocks['db'] = $this->getMock('\OCP\IDBConnection');
- $mocks['helper'] = $this->getMock('\OCA\User_LDAP\Helper');
+ $mocks['ocConfig'] = $this->createMock(IConfig::class);
+ $mocks['db'] = $this->createMock(IDBConnection::class);
+ $mocks['helper'] = $this->createMock(Helper::class);
return $mocks;
}
diff --git a/apps/user_ldap/tests/Mapping/AbstractMappingTest.php b/apps/user_ldap/tests/Mapping/AbstractMappingTest.php
index 1d988126df0..91013085c2c 100644
--- a/apps/user_ldap/tests/Mapping/AbstractMappingTest.php
+++ b/apps/user_ldap/tests/Mapping/AbstractMappingTest.php
@@ -26,6 +26,8 @@
namespace OCA\User_LDAP\Tests\Mapping;
+use OCP\IDBConnection;
+
abstract class AbstractMappingTest extends \Test\TestCase {
abstract public function getMapper(\OCP\IDBConnection $dbMock);
@@ -33,7 +35,7 @@ abstract class AbstractMappingTest extends \Test\TestCase {
* kiss test on isColNameValid
*/
public function testIsColNameValid() {
- $dbMock = $this->getMock('\OCP\IDBConnection');
+ $dbMock = $this->createMock(IDBConnection::class);
$mapper = $this->getMapper($dbMock);
$this->assertTrue($mapper->isColNameValid('ldap_dn'));
diff --git a/apps/user_ldap/tests/User/ManagerTest.php b/apps/user_ldap/tests/User/ManagerTest.php
index b3f22d6a068..16d6a3d9d6e 100644
--- a/apps/user_ldap/tests/User/ManagerTest.php
+++ b/apps/user_ldap/tests/User/ManagerTest.php
@@ -26,7 +26,16 @@
namespace OCA\User_LDAP\Tests\User;
+use OCA\User_LDAP\FilesystemHelper;
+use OCA\User_LDAP\ILDAPWrapper;
+use OCA\User_LDAP\LogWrapper;
+use OCA\User_LDAP\User\IUserTools;
use OCA\User_LDAP\User\Manager;
+use OCP\IAvatarManager;
+use OCP\IConfig;
+use OCP\IDBConnection;
+use OCP\Image;
+use OCP\IUserManager;
/**
* Class Test_User_Manager
@@ -38,17 +47,17 @@ use OCA\User_LDAP\User\Manager;
class ManagerTest extends \Test\TestCase {
private function getTestInstances() {
- $access = $this->getMock('\OCA\User_LDAP\User\IUserTools');
- $config = $this->getMock('\OCP\IConfig');
- $filesys = $this->getMock('\OCA\User_LDAP\FilesystemHelper');
- $log = $this->getMock('\OCA\User_LDAP\LogWrapper');
- $avaMgr = $this->getMock('\OCP\IAvatarManager');
- $image = $this->getMock('\OCP\Image');
- $dbc = $this->getMock('\OCP\IDBConnection');
- $userMgr = $this->getMock('\OCP\IUserManager');
+ $access = $this->createMock(IUserTools::class);
+ $config = $this->createMock(IConfig::class);
+ $filesys = $this->createMock(FilesystemHelper::class);
+ $log = $this->createMock(LogWrapper::class);
+ $avaMgr = $this->createMock(IAvatarManager::class);
+ $image = $this->createMock(Image::class);
+ $dbc = $this->createMock(IDBConnection::class);
+ $userMgr = $this->createMock(IUserManager::class);
$connection = new \OCA\User_LDAP\Connection(
- $lw = $this->getMock('\OCA\User_LDAP\ILDAPWrapper'),
+ $lw = $this->createMock(ILDAPWrapper::class),
'',
null
);
diff --git a/apps/user_ldap/tests/User/UserTest.php b/apps/user_ldap/tests/User/UserTest.php
index d9e43dee047..6e6e2ad66b1 100644
--- a/apps/user_ldap/tests/User/UserTest.php
+++ b/apps/user_ldap/tests/User/UserTest.php
@@ -25,7 +25,17 @@
namespace OCA\User_LDAP\Tests\User;
+use OCA\User_LDAP\FilesystemHelper;
+use OCA\User_LDAP\ILDAPWrapper;
+use OCA\User_LDAP\LogWrapper;
+use OCA\User_LDAP\User\IUserTools;
use OCA\User_LDAP\User\User;
+use OCP\IAvatar;
+use OCP\IAvatarManager;
+use OCP\IConfig;
+use OCP\IDBConnection;
+use OCP\Image;
+use OCP\IUser;
use OCP\IUserManager;
/**
@@ -38,14 +48,14 @@ use OCP\IUserManager;
class UserTest extends \Test\TestCase {
private function getTestInstances() {
- $access = $this->getMock('\OCA\User_LDAP\User\IUserTools');
- $config = $this->getMock('\OCP\IConfig');
- $filesys = $this->getMock('\OCA\User_LDAP\FilesystemHelper');
- $log = $this->getMock('\OCA\User_LDAP\LogWrapper');
- $avaMgr = $this->getMock('\OCP\IAvatarManager');
- $image = $this->getMock('\OCP\Image');
- $dbc = $this->getMock('\OCP\IDBConnection');
- $userMgr = $this->getMock('\OCP\IUserManager');
+ $access = $this->createMock(IUserTools::class);
+ $config = $this->createMock(IConfig::class);
+ $filesys = $this->createMock(FilesystemHelper::class);
+ $log = $this->createMock(LogWrapper::class);
+ $avaMgr = $this->createMock(IAvatarManager::class);
+ $image = $this->createMock(Image::class);
+ $dbc = $this->createMock(IDBConnection::class);
+ $userMgr = $this->createMock(IUserManager::class);
return array($access, $config, $filesys, $image, $log, $avaMgr, $dbc, $userMgr);
}
@@ -62,10 +72,10 @@ class UserTest extends \Test\TestCase {
unset($accMethods[array_search('getConnection', $accMethods)]);
$umMethods = get_class_methods('\OCA\User_LDAP\User\Manager');
}
- $lw = $this->getMock('\OCA\User_LDAP\ILDAPWrapper');
- $im = $this->getMock('\OCP\Image');
+ $lw = $this->createMock(ILDAPWrapper::class);
+ $im = $this->createMock(Image::class);
if (is_null($userMgr)) {
- $userMgr = $this->getMock('\OCP\IUserManager');
+ $userMgr = $this->createMock(IUserManager::class);
}
$um = $this->getMock('\OCA\User_LDAP\User\Manager',
$umMethods, array($cfMock, $fsMock, $logMock, $avaMgr, $im, $dbc, $userMgr));
@@ -212,7 +222,7 @@ class UserTest extends \Test\TestCase {
$this->equalTo('myquota'))
->will($this->returnValue(array('42 GB')));
- $user = $this->getMock('\OCP\IUser');
+ $user = $this->createMock(IUser::class);
$user->expects($this->once())
->method('setQuota')
->with('42 GB');
@@ -257,7 +267,7 @@ class UserTest extends \Test\TestCase {
$this->equalTo('myquota'))
->will($this->returnValue(false));
- $user = $this->getMock('\OCP\IUser');
+ $user = $this->createMock(IUser::class);
$user->expects($this->once())
->method('setQuota')
->with('25 GB');
@@ -302,7 +312,7 @@ class UserTest extends \Test\TestCase {
$this->equalTo('myquota'))
->will($this->returnValue(array('27 GB')));
- $user = $this->getMock('\OCP\IUser');
+ $user = $this->createMock(IUser::class);
$user->expects($this->once())
->method('setQuota')
->with('27 GB');
@@ -416,7 +426,7 @@ class UserTest extends \Test\TestCase {
$access->expects($this->never())
->method('readAttribute');
- $user = $this->getMock('\OCP\IUser');
+ $user = $this->createMock(IUser::class);
$user->expects($this->once())
->method('setQuota')
->with($readQuota);
@@ -466,7 +476,7 @@ class UserTest extends \Test\TestCase {
->method('isLoaded')
->will($this->returnValue(true));
- $avatar = $this->getMock('\OCP\IAvatar');
+ $avatar = $this->createMock(IAvatar::class);
$avatar->expects($this->once())
->method('set')
->with($this->isInstanceOf($image));
@@ -524,7 +534,7 @@ class UserTest extends \Test\TestCase {
->method('isLoaded')
->will($this->returnValue(true));
- $avatar = $this->getMock('\OCP\IAvatar');
+ $avatar = $this->createMock(IAvatar::class);
$avatar->expects($this->once())
->method('set')
->with($this->isInstanceOf($image));
diff --git a/apps/user_ldap/tests/User_LDAPTest.php b/apps/user_ldap/tests/User_LDAPTest.php
index 47e789142e5..0e08998d13b 100644
--- a/apps/user_ldap/tests/User_LDAPTest.php
+++ b/apps/user_ldap/tests/User_LDAPTest.php
@@ -28,9 +28,17 @@
namespace OCA\User_LDAP\Tests;
+use OCA\User_LDAP\FilesystemHelper;
+use OCA\User_LDAP\ILDAPWrapper;
+use OCA\User_LDAP\LogWrapper;
use OCA\User_LDAP\User_LDAP as UserLDAP;
use \OCA\User_LDAP\Access;
use \OCA\User_LDAP\Connection;
+use OCP\IAvatarManager;
+use OCP\IConfig;
+use OCP\IDBConnection;
+use OCP\Image;
+use OCP\IUserManager;
/**
* Class Test_User_Ldap_Direct
@@ -65,12 +73,12 @@ class User_LDAPTest extends \Test\TestCase {
unset($uMethods[array_search('getDN', $uMethods)]);
unset($uMethods[array_search('__construct', $uMethods)]);
}
- $lw = $this->getMock('\OCA\User_LDAP\ILDAPWrapper');
+ $lw = $this->createMock(ILDAPWrapper::class);
$connector = $this->getMock('\OCA\User_LDAP\Connection',
$conMethods,
array($lw, null, null));
- $this->configMock = $this->getMock('\OCP\IConfig');
+ $this->configMock = $this->createMock(IConfig::class);
$offlineUser = $this->getMockBuilder('\OCA\User_LDAP\User\OfflineUser')
->disableOriginalConstructor()
@@ -80,12 +88,12 @@ class User_LDAPTest extends \Test\TestCase {
->setMethods(['getDeletedUser'])
->setConstructorArgs([
$this->configMock,
- $this->getMock('\OCA\User_LDAP\FilesystemHelper'),
- $this->getMock('\OCA\User_LDAP\LogWrapper'),
- $this->getMock('\OCP\IAvatarManager'),
- $this->getMock('\OCP\Image'),
- $this->getMock('\OCP\IDBConnection'),
- $this->getMock('\OCP\IUserManager')
+ $this->createMock(FilesystemHelper::class),
+ $this->createMock(LogWrapper::class),
+ $this->createMock(IAvatarManager::class),
+ $this->createMock(Image::class),
+ $this->createMock(IDBConnection::class),
+ $this->createMock(IUserManager::class)
])
->getMock();
@@ -189,7 +197,7 @@ class User_LDAPTest extends \Test\TestCase {
$access = $this->getAccessMock();
$this->prepareAccessForCheckPassword($access);
- $backend = new UserLDAP($access, $this->getMock('\OCP\IConfig'));
+ $backend = new UserLDAP($access, $this->createMock(IConfig::class));
\OC_User::useBackend($backend);
$result = $backend->checkPassword('roland', 'dt19');
@@ -200,7 +208,7 @@ class User_LDAPTest extends \Test\TestCase {
$access = $this->getAccessMock();
$this->prepareAccessForCheckPassword($access);
- $backend = new UserLDAP($access, $this->getMock('\OCP\IConfig'));
+ $backend = new UserLDAP($access, $this->createMock(IConfig::class));
\OC_User::useBackend($backend);
$result = $backend->checkPassword('roland', 'wrong');
@@ -211,7 +219,7 @@ class User_LDAPTest extends \Test\TestCase {
$access = $this->getAccessMock();
$this->prepareAccessForCheckPassword($access);
- $backend = new UserLDAP($access, $this->getMock('\OCP\IConfig'));
+ $backend = new UserLDAP($access, $this->createMock(IConfig::class));
\OC_User::useBackend($backend);
$result = $backend->checkPassword('mallory', 'evil');
@@ -226,7 +234,7 @@ class User_LDAPTest extends \Test\TestCase {
->method('username2dn')
->will($this->returnValue(false));
- $backend = new UserLDAP($access, $this->getMock('\OCP\IConfig'));
+ $backend = new UserLDAP($access, $this->createMock(IConfig::class));
\OC_User::useBackend($backend);
$result = $backend->checkPassword('roland', 'dt19');
@@ -236,7 +244,7 @@ class User_LDAPTest extends \Test\TestCase {
public function testCheckPasswordPublicAPI() {
$access = $this->getAccessMock();
$this->prepareAccessForCheckPassword($access);
- $backend = new UserLDAP($access, $this->getMock('\OCP\IConfig'));
+ $backend = new UserLDAP($access, $this->createMock(IConfig::class));
\OC_User::useBackend($backend);
$result = \OCP\User::checkPassword('roland', 'dt19');
@@ -246,7 +254,7 @@ class User_LDAPTest extends \Test\TestCase {
public function testCheckPasswordPublicAPIWrongPassword() {
$access = $this->getAccessMock();
$this->prepareAccessForCheckPassword($access);
- $backend = new UserLDAP($access, $this->getMock('\OCP\IConfig'));
+ $backend = new UserLDAP($access, $this->createMock(IConfig::class));
\OC_User::useBackend($backend);
$result = \OCP\User::checkPassword('roland', 'wrong');
@@ -256,7 +264,7 @@ class User_LDAPTest extends \Test\TestCase {
public function testCheckPasswordPublicAPIWrongUser() {
$access = $this->getAccessMock();
$this->prepareAccessForCheckPassword($access);
- $backend = new UserLDAP($access, $this->getMock('\OCP\IConfig'));
+ $backend = new UserLDAP($access, $this->createMock(IConfig::class));
\OC_User::useBackend($backend);
$result = \OCP\User::checkPassword('mallory', 'evil');
@@ -265,7 +273,7 @@ class User_LDAPTest extends \Test\TestCase {
public function testDeleteUserCancel() {
$access = $this->getAccessMock();
- $backend = new UserLDAP($access, $this->getMock('\OCP\IConfig'));
+ $backend = new UserLDAP($access, $this->createMock(IConfig::class));
$result = $backend->deleteUser('notme');
$this->assertFalse($result);
}
@@ -282,7 +290,7 @@ class User_LDAPTest extends \Test\TestCase {
->method('getUserMapper')
->will($this->returnValue($mapping));
- $config = $this->getMock('\OCP\IConfig');
+ $config = $this->createMock(IConfig::class);
$config->expects($this->exactly(2))
->method('getUserValue')
->will($this->onConsecutiveCalls('1', '/var/vhome/jdings/'));
@@ -348,7 +356,7 @@ class User_LDAPTest extends \Test\TestCase {
public function testGetUsersNoParam() {
$access = $this->getAccessMock();
$this->prepareAccessForGetUsers($access);
- $backend = new UserLDAP($access, $this->getMock('\OCP\IConfig'));
+ $backend = new UserLDAP($access, $this->createMock(IConfig::class));
$result = $backend->getUsers();
$this->assertEquals(3, count($result));
@@ -357,7 +365,7 @@ class User_LDAPTest extends \Test\TestCase {
public function testGetUsersLimitOffset() {
$access = $this->getAccessMock();
$this->prepareAccessForGetUsers($access);
- $backend = new UserLDAP($access, $this->getMock('\OCP\IConfig'));
+ $backend = new UserLDAP($access, $this->createMock(IConfig::class));
$result = $backend->getUsers('', 1, 2);
$this->assertEquals(1, count($result));
@@ -366,7 +374,7 @@ class User_LDAPTest extends \Test\TestCase {
public function testGetUsersLimitOffset2() {
$access = $this->getAccessMock();
$this->prepareAccessForGetUsers($access);
- $backend = new UserLDAP($access, $this->getMock('\OCP\IConfig'));
+ $backend = new UserLDAP($access, $this->createMock(IConfig::class));
$result = $backend->getUsers('', 2, 1);
$this->assertEquals(2, count($result));
@@ -375,7 +383,7 @@ class User_LDAPTest extends \Test\TestCase {
public function testGetUsersSearchWithResult() {
$access = $this->getAccessMock();
$this->prepareAccessForGetUsers($access);
- $backend = new UserLDAP($access, $this->getMock('\OCP\IConfig'));
+ $backend = new UserLDAP($access, $this->createMock(IConfig::class));
$result = $backend->getUsers('yo');
$this->assertEquals(2, count($result));
@@ -384,7 +392,7 @@ class User_LDAPTest extends \Test\TestCase {
public function testGetUsersSearchEmptyResult() {
$access = $this->getAccessMock();
$this->prepareAccessForGetUsers($access);
- $backend = new UserLDAP($access, $this->getMock('\OCP\IConfig'));
+ $backend = new UserLDAP($access, $this->createMock(IConfig::class));
$result = $backend->getUsers('nix');
$this->assertEquals(0, count($result));
@@ -393,7 +401,7 @@ class User_LDAPTest extends \Test\TestCase {
public function testGetUsersViaAPINoParam() {
$access = $this->getAccessMock();
$this->prepareAccessForGetUsers($access);
- $backend = new UserLDAP($access, $this->getMock('\OCP\IConfig'));
+ $backend = new UserLDAP($access, $this->createMock(IConfig::class));
\OC_User::useBackend($backend);
$result = \OCP\User::getUsers();
@@ -403,7 +411,7 @@ class User_LDAPTest extends \Test\TestCase {
public function testGetUsersViaAPILimitOffset() {
$access = $this->getAccessMock();
$this->prepareAccessForGetUsers($access);
- $backend = new UserLDAP($access, $this->getMock('\OCP\IConfig'));
+ $backend = new UserLDAP($access, $this->createMock(IConfig::class));
\OC_User::useBackend($backend);
$result = \OCP\User::getUsers('', 1, 2);
@@ -413,7 +421,7 @@ class User_LDAPTest extends \Test\TestCase {
public function testGetUsersViaAPILimitOffset2() {
$access = $this->getAccessMock();
$this->prepareAccessForGetUsers($access);
- $backend = new UserLDAP($access, $this->getMock('\OCP\IConfig'));
+ $backend = new UserLDAP($access, $this->createMock(IConfig::class));
\OC_User::useBackend($backend);
$result = \OCP\User::getUsers('', 2, 1);
@@ -423,7 +431,7 @@ class User_LDAPTest extends \Test\TestCase {
public function testGetUsersViaAPISearchWithResult() {
$access = $this->getAccessMock();
$this->prepareAccessForGetUsers($access);
- $backend = new UserLDAP($access, $this->getMock('\OCP\IConfig'));
+ $backend = new UserLDAP($access, $this->createMock(IConfig::class));
\OC_User::useBackend($backend);
$result = \OCP\User::getUsers('yo');
@@ -433,7 +441,7 @@ class User_LDAPTest extends \Test\TestCase {
public function testGetUsersViaAPISearchEmptyResult() {
$access = $this->getAccessMock();
$this->prepareAccessForGetUsers($access);
- $backend = new UserLDAP($access, $this->getMock('\OCP\IConfig'));
+ $backend = new UserLDAP($access, $this->createMock(IConfig::class));
\OC_User::useBackend($backend);
$result = \OCP\User::getUsers('nix');
@@ -442,7 +450,7 @@ class User_LDAPTest extends \Test\TestCase {
public function testUserExists() {
$access = $this->getAccessMock();
- $backend = new UserLDAP($access, $this->getMock('\OCP\IConfig'));
+ $backend = new UserLDAP($access, $this->createMock(IConfig::class));
$this->prepareMockForUserExists($access);
$access->expects($this->any())
@@ -464,7 +472,7 @@ class User_LDAPTest extends \Test\TestCase {
*/
public function testUserExistsForDeleted() {
$access = $this->getAccessMock();
- $backend = new UserLDAP($access, $this->getMock('\OCP\IConfig'));
+ $backend = new UserLDAP($access, $this->createMock(IConfig::class));
$this->prepareMockForUserExists($access);
$access->expects($this->any())
@@ -482,7 +490,7 @@ class User_LDAPTest extends \Test\TestCase {
public function testUserExistsForNeverExisting() {
$access = $this->getAccessMock();
- $backend = new UserLDAP($access, $this->getMock('\OCP\IConfig'));
+ $backend = new UserLDAP($access, $this->createMock(IConfig::class));
$this->prepareMockForUserExists($access);
$access->expects($this->any())
@@ -501,7 +509,7 @@ class User_LDAPTest extends \Test\TestCase {
public function testUserExistsPublicAPI() {
$access = $this->getAccessMock();
- $backend = new UserLDAP($access, $this->getMock('\OCP\IConfig'));
+ $backend = new UserLDAP($access, $this->createMock(IConfig::class));
$this->prepareMockForUserExists($access);
\OC_User::useBackend($backend);
@@ -524,7 +532,7 @@ class User_LDAPTest extends \Test\TestCase {
*/
public function testUserExistsPublicAPIForDeleted() {
$access = $this->getAccessMock();
- $backend = new UserLDAP($access, $this->getMock('\OCP\IConfig'));
+ $backend = new UserLDAP($access, $this->createMock(IConfig::class));
$this->prepareMockForUserExists($access);
\OC_User::useBackend($backend);
@@ -543,7 +551,7 @@ class User_LDAPTest extends \Test\TestCase {
public function testUserExistsPublicAPIForNeverExisting() {
$access = $this->getAccessMock();
- $backend = new UserLDAP($access, $this->getMock('\OCP\IConfig'));
+ $backend = new UserLDAP($access, $this->createMock(IConfig::class));
$this->prepareMockForUserExists($access);
\OC_User::useBackend($backend);
@@ -563,7 +571,7 @@ class User_LDAPTest extends \Test\TestCase {
public function testDeleteUser() {
$access = $this->getAccessMock();
- $backend = new UserLDAP($access, $this->getMock('\OCP\IConfig'));
+ $backend = new UserLDAP($access, $this->createMock(IConfig::class));
//we do not support deleting users at all
$result = $backend->deleteUser('gunslinger');
@@ -572,7 +580,7 @@ class User_LDAPTest extends \Test\TestCase {
public function testGetHomeAbsolutePath() {
$access = $this->getAccessMock();
- $config = $this->getMock('\OCP\IConfig');
+ $config = $this->createMock(IConfig::class);
$backend = new UserLDAP($access, $config);
$this->prepareMockForUserExists($access);
@@ -607,7 +615,7 @@ class User_LDAPTest extends \Test\TestCase {
public function testGetHomeRelative() {
$access = $this->getAccessMock();
- $config = $this->getMock('\OCP\IConfig');
+ $config = $this->createMock(IConfig::class);
$backend = new UserLDAP($access, $config);
$this->prepareMockForUserExists($access);
@@ -651,7 +659,7 @@ class User_LDAPTest extends \Test\TestCase {
*/
public function testGetHomeNoPath() {
$access = $this->getAccessMock();
- $backend = new UserLDAP($access, $this->getMock('\OCP\IConfig'));
+ $backend = new UserLDAP($access, $this->createMock(IConfig::class));
$this->prepareMockForUserExists($access);
$access->connection->expects($this->any())
@@ -682,7 +690,7 @@ class User_LDAPTest extends \Test\TestCase {
*/
public function testGetHomeDeletedUser() {
$access = $this->getAccessMock();
- $backend = new UserLDAP($access, $this->getMock('\OCP\IConfig'));
+ $backend = new UserLDAP($access, $this->createMock(IConfig::class));
$this->prepareMockForUserExists($access);
$access->connection->expects($this->any())
@@ -753,7 +761,7 @@ class User_LDAPTest extends \Test\TestCase {
public function testGetDisplayName() {
$access = $this->getAccessMock();
$this->prepareAccessForGetDisplayName($access);
- $backend = new UserLDAP($access, $this->getMock('\OCP\IConfig'));
+ $backend = new UserLDAP($access, $this->createMock(IConfig::class));
$this->prepareMockForUserExists($access);
$access->connection->expects($this->any())
@@ -794,7 +802,7 @@ class User_LDAPTest extends \Test\TestCase {
}
}));
$this->prepareAccessForGetDisplayName($access);
- $backend = new UserLDAP($access, $this->getMock('\OCP\IConfig'));
+ $backend = new UserLDAP($access, $this->createMock(IConfig::class));
$this->prepareMockForUserExists($access);
$access->connection->expects($this->any())
@@ -824,7 +832,7 @@ class User_LDAPTest extends \Test\TestCase {
->method('countUsers')
->will($this->returnValue(5));
- $backend = new UserLDAP($access, $this->getMock('\OCP\IConfig'));
+ $backend = new UserLDAP($access, $this->createMock(IConfig::class));
$result = $backend->countUsers();
$this->assertEquals(5, $result);
@@ -837,7 +845,7 @@ class User_LDAPTest extends \Test\TestCase {
->method('countUsers')
->will($this->returnValue(false));
- $backend = new UserLDAP($access, $this->getMock('\OCP\IConfig'));
+ $backend = new UserLDAP($access, $this->createMock(IConfig::class));
$result = $backend->countUsers();
$this->assertFalse($result);
diff --git a/apps/user_ldap/tests/WizardTest.php b/apps/user_ldap/tests/WizardTest.php
index e82cbcfc82a..3aefa8779a2 100644
--- a/apps/user_ldap/tests/WizardTest.php
+++ b/apps/user_ldap/tests/WizardTest.php
@@ -26,6 +26,7 @@
namespace OCA\User_LDAP\Tests;
+use OCA\User_LDAP\ILDAPWrapper;
use \OCA\User_LDAP\Wizard;
/**
@@ -59,7 +60,7 @@ class WizardTest extends \Test\TestCase {
$connMethods = get_class_methods('\OCA\User_LDAP\Connection');
$accMethods = get_class_methods('\OCA\User_LDAP\Access');
}
- $lw = $this->getMock('\OCA\User_LDAP\ILDAPWrapper');
+ $lw = $this->createMock(ILDAPWrapper::class);
$conf = $this->getMock('\OCA\User_LDAP\Configuration',
$confMethods,
array($lw, null, null));