diff options
author | Morris Jobke <hey@morrisjobke.de> | 2017-10-24 16:26:53 +0300 |
---|---|---|
committer | Morris Jobke <hey@morrisjobke.de> | 2017-10-24 18:45:32 +0300 |
commit | 43e498844e8c1aa519a19238d2cf3d6b95e1aab0 (patch) | |
tree | 59510ef2ffc6c1fd1fd92475013b108f1da2bfeb /tests | |
parent | b1f77aca4effec99387481a831910d4870ae2ffc (diff) |
Use ::class in test mocks
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
Diffstat (limited to 'tests')
58 files changed, 257 insertions, 208 deletions
diff --git a/tests/Core/Controller/AvatarControllerTest.php b/tests/Core/Controller/AvatarControllerTest.php index 1a1f1130480..de568438022 100644 --- a/tests/Core/Controller/AvatarControllerTest.php +++ b/tests/Core/Controller/AvatarControllerTest.php @@ -85,16 +85,16 @@ class AvatarControllerTest extends \Test\TestCase { $this->avatarManager = $this->getMockBuilder('OCP\IAvatarManager')->getMock(); $this->cache = $this->getMockBuilder('OCP\ICache') ->disableOriginalConstructor()->getMock(); - $this->l = $this->getMockBuilder('OCP\IL10N')->getMock(); + $this->l = $this->getMockBuilder(IL10N::class)->getMock(); $this->l->method('t')->will($this->returnArgument(0)); - $this->userManager = $this->getMockBuilder('OCP\IUserManager')->getMock(); - $this->request = $this->getMockBuilder('OCP\IRequest')->getMock(); + $this->userManager = $this->getMockBuilder(IUserManager::class)->getMock(); + $this->request = $this->getMockBuilder(IRequest::class)->getMock(); $this->rootFolder = $this->getMockBuilder('OCP\Files\IRootFolder')->getMock(); - $this->logger = $this->getMockBuilder('OCP\ILogger')->getMock(); + $this->logger = $this->getMockBuilder(ILogger::class)->getMock(); $this->timeFactory = $this->getMockBuilder('OC\AppFramework\Utility\TimeFactory')->getMock(); $this->avatarMock = $this->getMockBuilder('OCP\IAvatar')->getMock(); - $this->userMock = $this->getMockBuilder('OCP\IUser')->getMock(); + $this->userMock = $this->getMockBuilder(IUser::class)->getMock(); $this->avatarController = new AvatarController( 'core', diff --git a/tests/Core/Controller/ChangePasswordControllerTest.php b/tests/Core/Controller/ChangePasswordControllerTest.php index ea3abb58e2f..851b5bd6c76 100644 --- a/tests/Core/Controller/ChangePasswordControllerTest.php +++ b/tests/Core/Controller/ChangePasswordControllerTest.php @@ -29,6 +29,7 @@ use OCP\AppFramework\Http\JSONResponse; use OCP\IGroupManager; use OCP\IL10N; use OCP\IRequest; +use OCP\IUser; use OCP\IUserManager; class ChangePasswordControllerTest extends \Test\TestCase { @@ -91,7 +92,7 @@ class ChangePasswordControllerTest extends \Test\TestCase { } public function testChangePersonalPasswordCommonPassword() { - $user = $this->getMockBuilder('OCP\IUser')->getMock(); + $user = $this->getMockBuilder(IUser::class)->getMock(); $this->userManager->expects($this->once()) ->method('checkPassword') ->with($this->userId, 'old') @@ -114,7 +115,7 @@ class ChangePasswordControllerTest extends \Test\TestCase { } public function testChangePersonalPasswordNoNewPassword() { - $user = $this->getMockBuilder('OCP\IUser')->getMock(); + $user = $this->getMockBuilder(IUser::class)->getMock(); $this->userManager->expects($this->once()) ->method('checkPassword') ->with($this->userId, 'old') @@ -130,7 +131,7 @@ class ChangePasswordControllerTest extends \Test\TestCase { } public function testChangePersonalPasswordCantSetPassword() { - $user = $this->getMockBuilder('OCP\IUser')->getMock(); + $user = $this->getMockBuilder(IUser::class)->getMock(); $this->userManager->expects($this->once()) ->method('checkPassword') ->with($this->userId, 'old') @@ -150,7 +151,7 @@ class ChangePasswordControllerTest extends \Test\TestCase { } public function testChangePersonalPassword() { - $user = $this->getMockBuilder('OCP\IUser')->getMock(); + $user = $this->getMockBuilder(IUser::class)->getMock(); $this->userManager->expects($this->once()) ->method('checkPassword') ->with($this->userId, 'old') diff --git a/tests/Core/Controller/LostControllerTest.php b/tests/Core/Controller/LostControllerTest.php index 196b1da352b..1e51de649e3 100644 --- a/tests/Core/Controller/LostControllerTest.php +++ b/tests/Core/Controller/LostControllerTest.php @@ -105,9 +105,9 @@ class LostControllerTest extends \Test\TestCase { })); $this->defaults = $this->getMockBuilder('\OCP\Defaults') ->disableOriginalConstructor()->getMock(); - $this->userManager = $this->getMockBuilder('\OCP\IUserManager') + $this->userManager = $this->getMockBuilder(IUserManager::class) ->disableOriginalConstructor()->getMock(); - $this->urlGenerator = $this->getMockBuilder('\OCP\IURLGenerator') + $this->urlGenerator = $this->getMockBuilder(IURLGenerator::class) ->disableOriginalConstructor()->getMock(); $this->mailer = $this->getMockBuilder('\OCP\Mail\IMailer') ->disableOriginalConstructor()->getMock(); @@ -115,7 +115,7 @@ class LostControllerTest extends \Test\TestCase { ->disableOriginalConstructor()->getMock(); $this->timeFactory = $this->getMockBuilder('\OCP\AppFramework\Utility\ITimeFactory') ->disableOriginalConstructor()->getMock(); - $this->request = $this->getMockBuilder('OCP\IRequest') + $this->request = $this->getMockBuilder(IRequest::class) ->disableOriginalConstructor()->getMock(); $this->encryptionManager = $this->getMockBuilder(IManager::class) ->disableOriginalConstructor()->getMock(); diff --git a/tests/Core/Middleware/TwoFactorMiddlewareTest.php b/tests/Core/Middleware/TwoFactorMiddlewareTest.php index 56022c78bdd..eb72b3e6796 100644 --- a/tests/Core/Middleware/TwoFactorMiddlewareTest.php +++ b/tests/Core/Middleware/TwoFactorMiddlewareTest.php @@ -22,8 +22,10 @@ namespace Test\Core\Middleware; +use OC\Authentication\TwoFactorAuth\Manager; use OC\Core\Middleware\TwoFactorMiddleware; use OC\AppFramework\Http\Request; +use OC\User\Session; use OCP\AppFramework\Controller; use OCP\AppFramework\Utility\IControllerMethodReflector; use OCP\IConfig; @@ -51,10 +53,10 @@ class TwoFactorMiddlewareTest extends TestCase { protected function setUp() { parent::setUp(); - $this->twoFactorManager = $this->getMockBuilder('\OC\Authentication\TwoFactorAuth\Manager') + $this->twoFactorManager = $this->getMockBuilder(Manager::class) ->disableOriginalConstructor() ->getMock(); - $this->userSession = $this->getMockBuilder('\OC\User\Session') + $this->userSession = $this->getMockBuilder(Session::class) ->disableOriginalConstructor() ->getMock(); $this->session = $this->createMock(ISession::class); diff --git a/tests/Settings/Controller/AdminSettingsControllerTest.php b/tests/Settings/Controller/AdminSettingsControllerTest.php index 51357f67a2d..d5650b397fa 100644 --- a/tests/Settings/Controller/AdminSettingsControllerTest.php +++ b/tests/Settings/Controller/AdminSettingsControllerTest.php @@ -25,6 +25,7 @@ namespace Tests\Settings\Controller; use OC\Settings\Admin\TipsTricks; use OC\Settings\Controller\AdminSettingsController; use OCP\AppFramework\Http\TemplateResponse; +use OCP\IConfig; use OCP\INavigationManager; use OCP\IRequest; use OCP\Settings\IManager; @@ -52,9 +53,9 @@ class AdminSettingsControllerTest extends TestCase { public function setUp() { parent::setUp(); - $this->request = $this->getMockBuilder('\OCP\IRequest')->getMock(); - $this->navigationManager = $this->getMockBuilder('\OCP\INavigationManager')->getMock(); - $this->settingsManager = $this->getMockBuilder('\OCP\Settings\IManager')->getMock(); + $this->request = $this->getMockBuilder(IRequest::class)->getMock(); + $this->navigationManager = $this->getMockBuilder(INavigationManager::class)->getMock(); + $this->settingsManager = $this->getMockBuilder(IManager::class)->getMock(); $this->adminSettingsController = new AdminSettingsController( 'settings', @@ -87,7 +88,7 @@ class AdminSettingsControllerTest extends TestCase { ->expects($this->once()) ->method('getAdminSettings') ->with('test') - ->willReturn([5 => new TipsTricks($this->getMockBuilder('\OCP\IConfig')->getMock())]); + ->willReturn([5 => new TipsTricks($this->getMockBuilder(IConfig::class)->getMock())]); $expected = new TemplateResponse('settings', 'settings/frame', ['forms' => ['personal' => [], 'admin' => []], 'content' => '']); $this->assertEquals($expected, $this->adminSettingsController->index('test')); diff --git a/tests/Settings/Controller/CertificateControllerTest.php b/tests/Settings/Controller/CertificateControllerTest.php index 48d34a1542b..fb5076dc012 100644 --- a/tests/Settings/Controller/CertificateControllerTest.php +++ b/tests/Settings/Controller/CertificateControllerTest.php @@ -51,10 +51,10 @@ class CertificateControllerTest extends \Test\TestCase { public function setUp() { parent::setUp(); - $this->request = $this->getMockBuilder('\OCP\IRequest')->getMock(); + $this->request = $this->getMockBuilder(IRequest::class)->getMock(); $this->certificateManager = $this->getMockBuilder('\OCP\ICertificateManager')->getMock(); $this->systemCertificateManager = $this->getMockBuilder('\OCP\ICertificateManager')->getMock(); - $this->l10n = $this->getMockBuilder('\OCP\IL10N')->getMock(); + $this->l10n = $this->getMockBuilder(IL10N::class)->getMock(); $this->appManager = $this->getMockBuilder('OCP\App\IAppManager')->getMock(); $this->certificateController = $this->getMockBuilder('OC\Settings\Controller\CertificateController') diff --git a/tests/Settings/Controller/CheckSetupControllerTest.php b/tests/Settings/Controller/CheckSetupControllerTest.php index 74eee3fea41..f0e203e714b 100644 --- a/tests/Settings/Controller/CheckSetupControllerTest.php +++ b/tests/Settings/Controller/CheckSetupControllerTest.php @@ -64,17 +64,17 @@ class CheckSetupControllerTest extends TestCase { public function setUp() { parent::setUp(); - $this->request = $this->getMockBuilder('\OCP\IRequest') + $this->request = $this->getMockBuilder(IRequest::class) ->disableOriginalConstructor()->getMock(); - $this->config = $this->getMockBuilder('\OCP\IConfig') + $this->config = $this->getMockBuilder(IConfig::class) ->disableOriginalConstructor()->getMock(); - $this->clientService = $this->getMockBuilder('\OCP\Http\Client\IClientService') + $this->clientService = $this->getMockBuilder(IClientService::class) ->disableOriginalConstructor()->getMock(); $this->util = $this->getMockBuilder('\OC_Util') ->disableOriginalConstructor()->getMock(); - $this->urlGenerator = $this->getMockBuilder('\OCP\IURLGenerator') + $this->urlGenerator = $this->getMockBuilder(IURLGenerator::class) ->disableOriginalConstructor()->getMock(); - $this->l10n = $this->getMockBuilder('\OCP\IL10N') + $this->l10n = $this->getMockBuilder(IL10N::class) ->disableOriginalConstructor()->getMock(); $this->l10n->expects($this->any()) ->method('t') @@ -83,7 +83,7 @@ class CheckSetupControllerTest extends TestCase { })); $this->checker = $this->getMockBuilder('\OC\IntegrityCheck\Checker') ->disableOriginalConstructor()->getMock(); - $this->logger = $this->getMockBuilder('\OCP\ILogger')->getMock(); + $this->logger = $this->getMockBuilder(ILogger::class)->getMock(); $this->checkSetupController = $this->getMockBuilder('\OC\Settings\Controller\CheckSetupController') ->setConstructorArgs([ 'settings', diff --git a/tests/Settings/Controller/EncryptionControllerTest.php b/tests/Settings/Controller/EncryptionControllerTest.php index e57f36353a6..b15a71fc016 100644 --- a/tests/Settings/Controller/EncryptionControllerTest.php +++ b/tests/Settings/Controller/EncryptionControllerTest.php @@ -25,11 +25,13 @@ use OC\DB\Connection; use OC\Files\View; use OC\Settings\Controller\EncryptionController; use OCP\App\IAppManager; +use OCA\Encryption\Migration; use OCP\IConfig; use OCP\IL10N; use OCP\ILogger; use OCP\IRequest; use OCP\IUserManager; +use OCP\UserInterface; use Test\TestCase; /** @@ -59,29 +61,29 @@ class EncryptionControllerTest extends TestCase { public function setUp() { parent::setUp(); - $this->request = $this->getMockBuilder('\\OCP\\IRequest') + $this->request = $this->getMockBuilder(IRequest::class) ->disableOriginalConstructor()->getMock(); - $this->l10n = $this->getMockBuilder('\\OCP\\IL10N') + $this->l10n = $this->getMockBuilder(IL10N::class) ->disableOriginalConstructor()->getMock(); $this->l10n->expects($this->any()) ->method('t') ->will($this->returnCallback(function($message, array $replace) { return vsprintf($message, $replace); })); - $this->config = $this->getMockBuilder('\\OCP\\IConfig') + $this->config = $this->getMockBuilder(IConfig::class) ->disableOriginalConstructor()->getMock(); - $this->connection = $this->getMockBuilder('\\OC\\DB\\Connection') + $this->connection = $this->getMockBuilder(Connection::class) ->disableOriginalConstructor()->getMock(); - $this->userManager = $this->getMockBuilder('\\OCP\\IUserManager') + $this->userManager = $this->getMockBuilder(IUserManager::class) ->disableOriginalConstructor()->getMock(); - $this->view = $this->getMockBuilder('\\OC\\Files\\View') + $this->view = $this->getMockBuilder(View::class) ->disableOriginalConstructor()->getMock(); - $this->logger = $this->getMockBuilder('\\OCP\\ILogger') + $this->logger = $this->getMockBuilder(ILogger::class) ->disableOriginalConstructor()->getMock(); $this->appManager = $this->getMockBuilder('\\OCP\\App\\IAppManager') ->disableOriginalConstructor()->getMock(); - $this->encryptionController = $this->getMockBuilder('\\OC\\Settings\\Controller\\EncryptionController') + $this->encryptionController = $this->getMockBuilder(EncryptionController::class) ->setConstructorArgs([ 'settings', $this->request, @@ -101,7 +103,7 @@ class EncryptionControllerTest extends TestCase { // we need to be able to autoload the class we're mocking \OC_App::registerAutoloading('encryption', \OC_App::getAppPath('encryption')); - $migration = $this->getMockBuilder('\\OCA\\Encryption\\Migration') + $migration = $this->getMockBuilder(Migration::class) ->disableOriginalConstructor()->getMock(); $this->encryptionController ->expects($this->once()) @@ -114,7 +116,7 @@ class EncryptionControllerTest extends TestCase { $migration ->expects($this->once()) ->method('updateDB'); - $backend = $this->getMockBuilder('\OCP\UserInterface') + $backend = $this->getMockBuilder(UserInterface::class) ->getMock(); $this->userManager ->expects($this->once()) diff --git a/tests/Settings/Controller/GroupsControllerTest.php b/tests/Settings/Controller/GroupsControllerTest.php index 340b39bf9dd..78df5f3a3cb 100644 --- a/tests/Settings/Controller/GroupsControllerTest.php +++ b/tests/Settings/Controller/GroupsControllerTest.php @@ -10,6 +10,7 @@ namespace Tests\Settings\Controller; +use OC\Group\Group; use OC\Group\MetaData; use OC\Settings\Controller\GroupsController; use OCP\AppFramework\Http; @@ -59,7 +60,7 @@ class GroupsControllerTest extends \Test\TestCase { * to test for subadmins. Thus the test always assumes you have admin permissions... */ public function testIndexSortByName() { - $firstGroup = $this->getMockBuilder('\OC\Group\Group') + $firstGroup = $this->getMockBuilder(Group::class) ->disableOriginalConstructor()->getMock(); $firstGroup ->method('getGID') @@ -67,7 +68,7 @@ class GroupsControllerTest extends \Test\TestCase { $firstGroup ->method('count') ->will($this->returnValue(12)); - $secondGroup = $this->getMockBuilder('\OC\Group\Group') + $secondGroup = $this->getMockBuilder(Group::class) ->disableOriginalConstructor()->getMock(); $secondGroup ->method('getGID') @@ -75,7 +76,7 @@ class GroupsControllerTest extends \Test\TestCase { $secondGroup ->method('count') ->will($this->returnValue(25)); - $thirdGroup = $this->getMockBuilder('\OC\Group\Group') + $thirdGroup = $this->getMockBuilder(Group::class) ->disableOriginalConstructor()->getMock(); $thirdGroup ->method('getGID') @@ -83,7 +84,7 @@ class GroupsControllerTest extends \Test\TestCase { $thirdGroup ->method('count') ->will($this->returnValue(14)); - $fourthGroup = $this->getMockBuilder('\OC\Group\Group') + $fourthGroup = $this->getMockBuilder(Group::class) ->disableOriginalConstructor()->getMock(); $fourthGroup ->method('getGID') @@ -151,7 +152,7 @@ class GroupsControllerTest extends \Test\TestCase { * to test for subadmins. Thus the test always assumes you have admin permissions... */ public function testIndexSortbyCount() { - $firstGroup = $this->getMockBuilder('\OC\Group\Group') + $firstGroup = $this->getMockBuilder(Group::class) ->disableOriginalConstructor()->getMock(); $firstGroup ->method('getGID') @@ -159,7 +160,7 @@ class GroupsControllerTest extends \Test\TestCase { $firstGroup ->method('count') ->will($this->returnValue(12)); - $secondGroup = $this->getMockBuilder('\OC\Group\Group') + $secondGroup = $this->getMockBuilder(Group::class) ->disableOriginalConstructor()->getMock(); $secondGroup ->method('getGID') @@ -167,7 +168,7 @@ class GroupsControllerTest extends \Test\TestCase { $secondGroup ->method('count') ->will($this->returnValue(25)); - $thirdGroup = $this->getMockBuilder('\OC\Group\Group') + $thirdGroup = $this->getMockBuilder(Group::class) ->disableOriginalConstructor()->getMock(); $thirdGroup ->method('getGID') @@ -175,7 +176,7 @@ class GroupsControllerTest extends \Test\TestCase { $thirdGroup ->method('count') ->will($this->returnValue(14)); - $fourthGroup = $this->getMockBuilder('\OC\Group\Group') + $fourthGroup = $this->getMockBuilder(Group::class) ->disableOriginalConstructor()->getMock(); $fourthGroup ->method('getGID') @@ -302,7 +303,7 @@ class GroupsControllerTest extends \Test\TestCase { } public function testDestroySuccessful() { - $group = $this->getMockBuilder('\OC\Group\Group') + $group = $this->getMockBuilder(Group::class) ->disableOriginalConstructor()->getMock(); $this->groupManager ->expects($this->once()) diff --git a/tests/Settings/Controller/UsersControllerTest.php b/tests/Settings/Controller/UsersControllerTest.php index cd08c834147..15c18fb7f08 100644 --- a/tests/Settings/Controller/UsersControllerTest.php +++ b/tests/Settings/Controller/UsersControllerTest.php @@ -11,9 +11,11 @@ namespace Tests\Settings\Controller; use OC\Accounts\AccountManager; +use OC\Group\Group; use OC\Group\Manager; use OC\Settings\Controller\UsersController; use OC\Settings\Mailer\NewUserMailHelper; +use OC\SubAdmin; use OCP\App\IAppManager; use OCP\AppFramework\Http; use OCP\AppFramework\Http\DataResponse; @@ -326,7 +328,7 @@ class UsersControllerTest extends \Test\TestCase { ->with('bar') ->will($this->returnValue($bar)); - $subadmin = $this->getMockBuilder('\OC\SubAdmin') + $subadmin = $this->getMockBuilder(SubAdmin::class) ->disableOriginalConstructor() ->getMock(); $subadmin @@ -546,19 +548,19 @@ class UsersControllerTest extends \Test\TestCase { ->with('admin') ->will($this->returnValue($admin)); - $subgroup1 = $this->getMockBuilder('\OCP\IGroup') + $subgroup1 = $this->getMockBuilder(IGroup::class) ->disableOriginalConstructor() ->getMock(); $subgroup1->expects($this->any()) ->method('getGID') ->will($this->returnValue('SubGroup1')); - $subgroup2 = $this->getMockBuilder('\OCP\IGroup') + $subgroup2 = $this->getMockBuilder(IGroup::class) ->disableOriginalConstructor() ->getMock(); $subgroup2->expects($this->any()) ->method('getGID') ->will($this->returnValue('SubGroup2')); - $subadmin = $this->getMockBuilder('\OC\SubAdmin') + $subadmin = $this->getMockBuilder(SubAdmin::class) ->disableOriginalConstructor() ->getMock(); $subadmin @@ -746,7 +748,7 @@ class UsersControllerTest extends \Test\TestCase { ->method('getUserGroupIds') ->will($this->onConsecutiveCalls(array('Users', 'Support'), array('admins', 'Support'), array('External Users'))); - $subadmin = $this->getMockBuilder('\OC\SubAdmin') + $subadmin = $this->getMockBuilder(SubAdmin::class) ->disableOriginalConstructor() ->getMock(); $subadmin->expects($this->any()) @@ -865,7 +867,7 @@ class UsersControllerTest extends \Test\TestCase { ->with('') ->will($this->returnValue([$user])); - $subadmin = $this->getMockBuilder('\OC\SubAdmin') + $subadmin = $this->getMockBuilder(SubAdmin::class) ->disableOriginalConstructor() ->getMock(); $subadmin->expects($this->once()) @@ -951,7 +953,7 @@ class UsersControllerTest extends \Test\TestCase { ->method('createUser') ->will($this->onConsecutiveCalls($user)); - $subadmin = $this->getMockBuilder('\OC\SubAdmin') + $subadmin = $this->getMockBuilder(SubAdmin::class) ->disableOriginalConstructor() ->getMock(); $subadmin @@ -1006,13 +1008,13 @@ class UsersControllerTest extends \Test\TestCase { $user->expects($this->any()) ->method('isEnabled') ->willReturn(true); - $existingGroup = $this->getMockBuilder('\OCP\IGroup') + $existingGroup = $this->getMockBuilder(IGroup::class) ->disableOriginalConstructor()->getMock(); $existingGroup ->expects($this->once()) ->method('addUser') ->with($user); - $newGroup = $this->getMockBuilder('\OCP\IGroup') + $newGroup = $this->getMockBuilder(IGroup::class) ->disableOriginalConstructor()->getMock(); $newGroup ->expects($this->once()) @@ -1038,7 +1040,7 @@ class UsersControllerTest extends \Test\TestCase { ->with($user) ->will($this->onConsecutiveCalls(array('NewGroup', 'ExistingGroup'))); - $subadmin = $this->getMockBuilder('\OC\SubAdmin') + $subadmin = $this->getMockBuilder(SubAdmin::class) ->disableOriginalConstructor() ->getMock(); $subadmin @@ -1358,7 +1360,7 @@ class UsersControllerTest extends \Test\TestCase { ->with('UserToDelete') ->will($this->returnValue($toDeleteUser)); - $subadmin = $this->getMockBuilder('\OC\SubAdmin') + $subadmin = $this->getMockBuilder(SubAdmin::class) ->disableOriginalConstructor() ->getMock(); $subadmin->expects($this->once()) @@ -1441,7 +1443,7 @@ class UsersControllerTest extends \Test\TestCase { ->with('UserToDelete') ->will($this->returnValue($toDeleteUser)); - $subadmin = $this->getMockBuilder('\OC\SubAdmin') + $subadmin = $this->getMockBuilder(SubAdmin::class) ->disableOriginalConstructor() ->getMock(); $subadmin->expects($this->once()) @@ -1487,7 +1489,7 @@ class UsersControllerTest extends \Test\TestCase { ->with('UserToDelete') ->will($this->returnValue($toDeleteUser)); - $subadmin = $this->getMockBuilder('\OC\SubAdmin') + $subadmin = $this->getMockBuilder(SubAdmin::class) ->disableOriginalConstructor() ->getMock(); $subadmin->expects($this->once()) @@ -1571,7 +1573,7 @@ class UsersControllerTest extends \Test\TestCase { ->expects($this->once()) ->method('createUser') ->will($this->onConsecutiveCalls($user)); - $subadmin = $this->getMockBuilder('\OC\SubAdmin') + $subadmin = $this->getMockBuilder(SubAdmin::class) ->disableOriginalConstructor() ->getMock(); $subadmin->expects($this->once()) @@ -1637,7 +1639,7 @@ class UsersControllerTest extends \Test\TestCase { list($user, $expectedResult) = $this->mockUser(); - $subadmin = $this->getMockBuilder('\OC\SubAdmin') + $subadmin = $this->getMockBuilder(SubAdmin::class) ->disableOriginalConstructor() ->getMock(); $subadmin->expects($this->once()) @@ -1684,7 +1686,7 @@ class UsersControllerTest extends \Test\TestCase { ) ->will($this->returnValue('1')); - $subadmin = $this->getMockBuilder('\OC\SubAdmin') + $subadmin = $this->getMockBuilder(SubAdmin::class) ->disableOriginalConstructor() ->getMock(); $subadmin->expects($this->once()) @@ -1722,7 +1724,7 @@ class UsersControllerTest extends \Test\TestCase { // without the master key enabled we use per-user keys -> restore is disabled $expectedResult['isRestoreDisabled'] = !$masterKeyEnabled; - $subadmin = $this->getMockBuilder('\OC\SubAdmin') + $subadmin = $this->getMockBuilder(SubAdmin::class) ->disableOriginalConstructor() ->getMock(); $subadmin->expects($this->once()) @@ -1779,7 +1781,7 @@ class UsersControllerTest extends \Test\TestCase { $expectedResult['isRestoreDisabled'] = true; - $subadmin = $this->getMockBuilder('\OC\SubAdmin') + $subadmin = $this->getMockBuilder(SubAdmin::class) ->disableOriginalConstructor() ->getMock(); $subadmin->expects($this->once()) @@ -1801,7 +1803,7 @@ class UsersControllerTest extends \Test\TestCase { list($user, $expectedResult) = $this->mockUser(); - $subadmin = $this->getMockBuilder('\OC\SubAdmin') + $subadmin = $this->getMockBuilder(SubAdmin::class) ->disableOriginalConstructor() ->getMock(); $subadmin->expects($this->once()) @@ -1853,21 +1855,21 @@ class UsersControllerTest extends \Test\TestCase { ->method('getUser') ->will($this->returnValue($user)); - $group1 = $this->getMockBuilder('\OC\Group\Group') + $group1 = $this->getMockBuilder(Group::class) ->disableOriginalConstructor()->getMock(); $group1 ->expects($this->once()) ->method('getUsers') ->will($this->returnValue(['foo' => 'M. Foo', 'admin' => 'S. Admin'])); - $group2 = $this->getMockBuilder('\OC\Group\Group') + $group2 = $this->getMockBuilder(Group::class) ->disableOriginalConstructor()->getMock(); $group2 ->expects($this->once()) ->method('getUsers') ->will($this->returnValue(['bar' => 'B. Ar'])); - $subadmin = $this->getMockBuilder('\OC\SubAdmin') + $subadmin = $this->getMockBuilder(SubAdmin::class) ->disableOriginalConstructor() ->getMock(); $subadmin @@ -1971,7 +1973,7 @@ class UsersControllerTest extends \Test\TestCase { ->willReturn($editUser); $this->accountManager->expects($this->any())->method('getUser')->willReturn([]); - $subadmin = $this->getMockBuilder('\OC\SubAdmin') + $subadmin = $this->getMockBuilder(SubAdmin::class) ->disableOriginalConstructor() ->getMock(); $subadmin @@ -2036,7 +2038,7 @@ class UsersControllerTest extends \Test\TestCase { ->with($user->getUID()) ->willReturn($user); - $subadmin = $this->getMockBuilder('\OC\SubAdmin') + $subadmin = $this->getMockBuilder(SubAdmin::class) ->disableOriginalConstructor() ->getMock(); $subadmin @@ -2437,7 +2439,7 @@ class UsersControllerTest extends \Test\TestCase { ->method('createUser') ->will($this->onConsecutiveCalls($user)); - $subadmin = $this->getMockBuilder('\OC\SubAdmin') + $subadmin = $this->getMockBuilder(SubAdmin::class) ->disableOriginalConstructor() ->getMock(); $subadmin @@ -2576,7 +2578,7 @@ class UsersControllerTest extends \Test\TestCase { } public function testDisableUserFailsDueSameUser() { - $user = $this->getMockBuilder('\OC\User\User') + $user = $this->getMockBuilder(User::class) ->disableOriginalConstructor()->getMock(); $user->expects($this->once()) ->method('getUID') @@ -2599,7 +2601,7 @@ class UsersControllerTest extends \Test\TestCase { } public function testDisableUserFailsDueNoAdminAndNoSubadmin() { - $user = $this->getMockBuilder('\OC\User\User') + $user = $this->getMockBuilder(User::class) ->disableOriginalConstructor()->getMock(); $user->expects($this->once()) ->method('getUID') @@ -2608,7 +2610,7 @@ class UsersControllerTest extends \Test\TestCase { ->expects($this->exactly(2)) ->method('getUser') ->will($this->returnValue($user)); - $user2 = $this->getMockBuilder('\OC\User\User') + $user2 = $this->getMockBuilder(User::class) ->disableOriginalConstructor()->getMock(); $user2->expects($this->never()) ->method('setEnabled'); @@ -2618,7 +2620,7 @@ class UsersControllerTest extends \Test\TestCase { ->with('abc') ->willReturn($user2); - $subadmin = $this->createMock('\OC\SubAdmin'); + $subadmin = $this->createMock(SubAdmin::class); $subadmin->expects($this->once()) ->method('isUserAccessible') ->will($this->returnValue(false)); @@ -2641,7 +2643,7 @@ class UsersControllerTest extends \Test\TestCase { } public function testDisableUserFailsDueNoUser() { - $user = $this->getMockBuilder('\OC\User\User') + $user = $this->getMockBuilder(User::class) ->disableOriginalConstructor()->getMock(); $user->expects($this->once()) ->method('getUID') @@ -2674,7 +2676,7 @@ class UsersControllerTest extends \Test\TestCase { } public function testDisableUserFailsDueNoUserForSubAdmin() { - $user = $this->getMockBuilder('\OC\User\User') + $user = $this->getMockBuilder(User::class) ->disableOriginalConstructor()->getMock(); $user->expects($this->once()) ->method('getUID') @@ -2707,7 +2709,7 @@ class UsersControllerTest extends \Test\TestCase { } public function testDisableUserSuccessForAdmin() { - $user = $this->getMockBuilder('\OC\User\User') + $user = $this->getMockBuilder(User::class) ->disableOriginalConstructor()->getMock(); $user->expects($this->once()) ->method('getUID') @@ -2716,7 +2718,7 @@ class UsersControllerTest extends \Test\TestCase { ->expects($this->exactly(1)) ->method('getUser') ->will($this->returnValue($user)); - $user2 = $this->getMockBuilder('\OC\User\User') + $user2 = $this->getMockBuilder(User::class) ->disableOriginalConstructor()->getMock(); $user2->expects($this->once()) ->method('setEnabled') @@ -2745,7 +2747,7 @@ class UsersControllerTest extends \Test\TestCase { } public function testDisableUserSuccessForSubAdmin() { - $user = $this->getMockBuilder('\OC\User\User') + $user = $this->getMockBuilder(User::class) ->disableOriginalConstructor()->getMock(); $user->expects($this->once()) ->method('getUID') @@ -2754,7 +2756,7 @@ class UsersControllerTest extends \Test\TestCase { ->expects($this->exactly(2)) ->method('getUser') ->will($this->returnValue($user)); - $user2 = $this->getMockBuilder('\OC\User\User') + $user2 = $this->getMockBuilder(User::class) ->disableOriginalConstructor()->getMock(); $user2->expects($this->once()) ->method('setEnabled'); @@ -2764,7 +2766,7 @@ class UsersControllerTest extends \Test\TestCase { ->with('abc') ->willReturn($user2); - $subadmin = $this->createMock('\OC\SubAdmin'); + $subadmin = $this->createMock(SubAdmin::class); $subadmin->expects($this->once()) ->method('isUserAccessible') ->will($this->returnValue(true)); @@ -2787,7 +2789,7 @@ class UsersControllerTest extends \Test\TestCase { } public function testEnableUserFailsDueSameUser() { - $user = $this->getMockBuilder('\OC\User\User') + $user = $this->getMockBuilder(User::class) ->disableOriginalConstructor()->getMock(); $user->expects($this->once()) ->method('getUID') @@ -2810,7 +2812,7 @@ class UsersControllerTest extends \Test\TestCase { } public function testEnableUserFailsDueNoAdminAndNoSubadmin() { - $user = $this->getMockBuilder('\OC\User\User') + $user = $this->getMockBuilder(User::class) ->disableOriginalConstructor()->getMock(); $user->expects($this->once()) ->method('getUID') @@ -2819,7 +2821,7 @@ class UsersControllerTest extends \Test\TestCase { ->expects($this->exactly(2)) ->method('getUser') ->will($this->returnValue($user)); - $user2 = $this->getMockBuilder('\OC\User\User') + $user2 = $this->getMockBuilder(User::class) ->disableOriginalConstructor()->getMock(); $user2->expects($this->never()) ->method('setEnabled'); @@ -2829,7 +2831,7 @@ class UsersControllerTest extends \Test\TestCase { ->with('abc') ->willReturn($user2); - $subadmin = $this->createMock('\OC\SubAdmin'); + $subadmin = $this->createMock(SubAdmin::class); $subadmin->expects($this->once()) ->method('isUserAccessible') ->will($this->returnValue(false)); @@ -2852,7 +2854,7 @@ class UsersControllerTest extends \Test\TestCase { } public function testEnableUserFailsDueNoUser() { - $user = $this->getMockBuilder('\OC\User\User') + $user = $this->getMockBuilder(User::class) ->disableOriginalConstructor()->getMock(); $user->expects($this->once()) ->method('getUID') @@ -2885,7 +2887,7 @@ class UsersControllerTest extends \Test\TestCase { } public function testEnableUserFailsDueNoUserForSubAdmin() { - $user = $this->getMockBuilder('\OC\User\User') + $user = $this->getMockBuilder(User::class) ->disableOriginalConstructor()->getMock(); $user->expects($this->once()) ->method('getUID') @@ -2918,7 +2920,7 @@ class UsersControllerTest extends \Test\TestCase { } public function testEnableUserSuccessForAdmin() { - $user = $this->getMockBuilder('\OC\User\User') + $user = $this->getMockBuilder(User::class) ->disableOriginalConstructor()->getMock(); $user->expects($this->once()) ->method('getUID') @@ -2927,7 +2929,7 @@ class UsersControllerTest extends \Test\TestCase { ->expects($this->exactly(1)) ->method('getUser') ->will($this->returnValue($user)); - $user2 = $this->getMockBuilder('\OC\User\User') + $user2 = $this->getMockBuilder(User::class) ->disableOriginalConstructor()->getMock(); $user2->expects($this->once()) ->method('setEnabled'); @@ -2955,7 +2957,7 @@ class UsersControllerTest extends \Test\TestCase { } public function testEnableUserSuccessForSubAdmin() { - $user = $this->getMockBuilder('\OC\User\User') + $user = $this->getMockBuilder(User::class) ->disableOriginalConstructor()->getMock(); $user->expects($this->once()) ->method('getUID') @@ -2964,7 +2966,7 @@ class UsersControllerTest extends \Test\TestCase { ->expects($this->exactly(2)) ->method('getUser') ->will($this->returnValue($user)); - $user2 = $this->getMockBuilder('\OC\User\User') + $user2 = $this->getMockBuilder(User::class) ->disableOriginalConstructor()->getMock(); $user2->expects($this->once()) ->method('setEnabled') @@ -2975,7 +2977,7 @@ class UsersControllerTest extends \Test\TestCase { ->with('abc') ->willReturn($user2); - $subadmin = $this->createMock('\OC\SubAdmin'); + $subadmin = $this->createMock(SubAdmin::class); $subadmin->expects($this->once()) ->method('isUserAccessible') ->will($this->returnValue(true)); diff --git a/tests/Settings/Middleware/SubadminMiddlewareTest.php b/tests/Settings/Middleware/SubadminMiddlewareTest.php index b2724047750..834a3fedf23 100644 --- a/tests/Settings/Middleware/SubadminMiddlewareTest.php +++ b/tests/Settings/Middleware/SubadminMiddlewareTest.php @@ -34,9 +34,9 @@ class SubadminMiddlewareTest extends \Test\TestCase { protected function setUp() { parent::setUp(); - $this->reflector = $this->getMockBuilder('\OC\AppFramework\Utility\ControllerMethodReflector') + $this->reflector = $this->getMockBuilder(ControllerMethodReflector::class) ->disableOriginalConstructor()->getMock(); - $this->controller = $this->getMockBuilder('\OCP\AppFramework\Controller') + $this->controller = $this->getMockBuilder(Controller::class) ->disableOriginalConstructor()->getMock(); $this->subadminMiddlewareAsSubAdmin = new SubadminMiddleware($this->reflector, true); diff --git a/tests/lib/APITest.php b/tests/lib/APITest.php index c2a25d1306c..b1ac8fbb24f 100644 --- a/tests/lib/APITest.php +++ b/tests/lib/APITest.php @@ -8,6 +8,8 @@ namespace Test; +use OCP\IRequest; + class APITest extends \Test\TestCase { // Helps build a response variable @@ -71,7 +73,7 @@ class APITest extends \Test\TestCase { * @param bool $expected */ public function testIsV2($scriptName, $expected) { - $request = $this->getMockBuilder('\OCP\IRequest') + $request = $this->getMockBuilder(IRequest::class) ->disableOriginalConstructor() ->getMock(); $request diff --git a/tests/lib/Accounts/AccountsManagerTest.php b/tests/lib/Accounts/AccountsManagerTest.php index 6cefebdea86..c4add0244bd 100644 --- a/tests/lib/Accounts/AccountsManagerTest.php +++ b/tests/lib/Accounts/AccountsManagerTest.php @@ -71,7 +71,7 @@ class AccountsManagerTest extends TestCase { * @return \PHPUnit_Framework_MockObject_MockObject | AccountManager */ public function getInstance($mockedMethods = null) { - return $this->getMockBuilder('OC\Accounts\AccountManager') + return $this->getMockBuilder(AccountManager::class) ->setConstructorArgs([$this->connection, $this->eventDispatcher, $this->jobList]) ->setMethods($mockedMethods) ->getMock(); @@ -146,7 +146,7 @@ class AccountsManagerTest extends TestCase { * @param array $setData * @param IUser $askUser * @param array $expectedData - * @param book $userAlreadyExists + * @param bool $userAlreadyExists */ public function testGetUser($setUser, $setData, $askUser, $expectedData, $userAlreadyExists) { $accountManager = $this->getInstance(['buildDefaultUserRecord', 'insertNewUser', 'addMissingDefaultValues']); @@ -172,9 +172,9 @@ class AccountsManagerTest extends TestCase { } public function dataTestGetUser() { - $user1 = $this->getMockBuilder('OCP\IUser')->getMock(); + $user1 = $this->getMockBuilder(IUser::class)->getMock(); $user1->expects($this->any())->method('getUID')->willReturn('user1'); - $user2 = $this->getMockBuilder('OCP\IUser')->getMock(); + $user2 = $this->getMockBuilder(IUser::class)->getMock(); $user2->expects($this->any())->method('getUID')->willReturn('user2'); return [ ['user1', ['key' => 'value'], $user1, ['key' => 'value'], true], @@ -183,7 +183,7 @@ class AccountsManagerTest extends TestCase { } public function testUpdateExistingUser() { - $user = $this->getMockBuilder('OCP\IUser')->getMock(); + $user = $this->getMockBuilder(IUser::class)->getMock(); $user->expects($this->once())->method('getUID')->willReturn('uid'); $oldData = ['key' => 'value']; $newData = ['newKey' => 'newValue']; @@ -196,7 +196,7 @@ class AccountsManagerTest extends TestCase { } public function testInsertNewUser() { - $user = $this->getMockBuilder('OCP\IUser')->getMock(); + $user = $this->getMockBuilder(IUser::class)->getMock(); $uid = 'uid'; $data = ['key' => 'value']; diff --git a/tests/lib/Activity/ManagerTest.php b/tests/lib/Activity/ManagerTest.php index 13932f389f8..a1877d3fcc6 100644 --- a/tests/lib/Activity/ManagerTest.php +++ b/tests/lib/Activity/ManagerTest.php @@ -12,6 +12,7 @@ namespace Test\Activity; use OCP\IConfig; use OCP\IRequest; +use OCP\IUser; use OCP\IUserSession; use OCP\RichObjectStrings\IValidator; use Test\TestCase; @@ -247,7 +248,7 @@ class ManagerTest extends TestCase { } protected function mockUserSession($user) { - $mockUser = $this->getMockBuilder('\OCP\IUser') + $mockUser = $this->getMockBuilder(IUser::class) ->disableOriginalConstructor() ->getMock(); $mockUser->expects($this->any()) @@ -314,7 +315,7 @@ class ManagerTest extends TestCase { */ public function testPublish($author, $expected) { if ($author !== null) { - $authorObject = $this->getMockBuilder('OCP\IUser') + $authorObject = $this->getMockBuilder(IUser::class) ->disableOriginalConstructor() ->getMock(); $authorObject->expects($this->once()) diff --git a/tests/lib/App/DependencyAnalyzerTest.php b/tests/lib/App/DependencyAnalyzerTest.php index 65b45a002d4..081f6d767db 100644 --- a/tests/lib/App/DependencyAnalyzerTest.php +++ b/tests/lib/App/DependencyAnalyzerTest.php @@ -59,7 +59,7 @@ class DependencyAnalyzerTest extends TestCase { ->method('getOcVersion') ->will( $this->returnValue('8.0.2')); - $this->l10nMock = $this->getMockBuilder('\OCP\IL10N') + $this->l10nMock = $this->getMockBuilder(IL10N::class) ->disableOriginalConstructor() ->getMock(); $this->l10nMock->expects($this->any()) diff --git a/tests/lib/AppFramework/Controller/ApiControllerTest.php b/tests/lib/AppFramework/Controller/ApiControllerTest.php index 74231b8d6ac..b7172ab6a9f 100644 --- a/tests/lib/AppFramework/Controller/ApiControllerTest.php +++ b/tests/lib/AppFramework/Controller/ApiControllerTest.php @@ -26,6 +26,7 @@ namespace Test\AppFramework\Controller; use OC\AppFramework\Http\Request; use OCP\AppFramework\ApiController; +use OCP\IConfig; class ChildApiController extends ApiController {}; @@ -41,7 +42,7 @@ class ApiControllerTest extends \Test\TestCase { $this->getMockBuilder('\OCP\Security\ISecureRandom') ->disableOriginalConstructor() ->getMock(), - $this->getMockBuilder('\OCP\IConfig') + $this->getMockBuilder(IConfig::class) ->disableOriginalConstructor() ->getMock() ); diff --git a/tests/lib/AppFramework/Controller/ControllerTest.php b/tests/lib/AppFramework/Controller/ControllerTest.php index 5c8124c5e7f..ca71e9154ef 100644 --- a/tests/lib/AppFramework/Controller/ControllerTest.php +++ b/tests/lib/AppFramework/Controller/ControllerTest.php @@ -29,6 +29,7 @@ use OCP\AppFramework\Controller; use OCP\AppFramework\Http\TemplateResponse; use OCP\AppFramework\Http\JSONResponse; use OCP\AppFramework\Http\DataResponse; +use OCP\IConfig; class ChildController extends Controller { @@ -79,7 +80,7 @@ class ControllerTest extends \Test\TestCase { $this->getMockBuilder('\OCP\Security\ISecureRandom') ->disableOriginalConstructor() ->getMock(), - $this->getMockBuilder('\OCP\IConfig') + $this->getMockBuilder(IConfig::class) ->disableOriginalConstructor() ->getMock() ); diff --git a/tests/lib/AppFramework/Http/DispatcherTest.php b/tests/lib/AppFramework/Http/DispatcherTest.php index c2d73adfd7b..eb08d00e358 100644 --- a/tests/lib/AppFramework/Http/DispatcherTest.php +++ b/tests/lib/AppFramework/Http/DispatcherTest.php @@ -31,6 +31,7 @@ use OCP\AppFramework\Http; use OCP\AppFramework\Http\JSONResponse; use OCP\AppFramework\Http\DataResponse; use OCP\AppFramework\Controller; +use OCP\IConfig; class TestController extends Controller { @@ -301,7 +302,7 @@ class DispatcherTest extends \Test\TestCase { $this->getMockBuilder('\OCP\Security\ISecureRandom') ->disableOriginalConstructor() ->getMock(), - $this->getMockBuilder('\OCP\IConfig') + $this->getMockBuilder(IConfig::class) ->disableOriginalConstructor() ->getMock() ); @@ -332,7 +333,7 @@ class DispatcherTest extends \Test\TestCase { $this->getMockBuilder('\OCP\Security\ISecureRandom') ->disableOriginalConstructor() ->getMock(), - $this->getMockBuilder('\OCP\IConfig') + $this->getMockBuilder(IConfig::class) ->disableOriginalConstructor() ->getMock() ); @@ -366,7 +367,7 @@ class DispatcherTest extends \Test\TestCase { $this->getMockBuilder('\OCP\Security\ISecureRandom') ->disableOriginalConstructor() ->getMock(), - $this->getMockBuilder('\OCP\IConfig') + $this->getMockBuilder(IConfig::class) ->disableOriginalConstructor() ->getMock() ); @@ -399,7 +400,7 @@ class DispatcherTest extends \Test\TestCase { $this->getMockBuilder('\OCP\Security\ISecureRandom') ->disableOriginalConstructor() ->getMock(), - $this->getMockBuilder('\OCP\IConfig') + $this->getMockBuilder(IConfig::class) ->disableOriginalConstructor() ->getMock() ); @@ -433,7 +434,7 @@ class DispatcherTest extends \Test\TestCase { $this->getMockBuilder('\OCP\Security\ISecureRandom') ->disableOriginalConstructor() ->getMock(), - $this->getMockBuilder('\OCP\IConfig') + $this->getMockBuilder(IConfig::class) ->disableOriginalConstructor() ->getMock() ); @@ -469,7 +470,7 @@ class DispatcherTest extends \Test\TestCase { $this->getMockBuilder('\OCP\Security\ISecureRandom') ->disableOriginalConstructor() ->getMock(), - $this->getMockBuilder('\OCP\IConfig') + $this->getMockBuilder(IConfig::class) ->disableOriginalConstructor() ->getMock() ); diff --git a/tests/lib/AppFramework/Http/RequestTest.php b/tests/lib/AppFramework/Http/RequestTest.php index 40698ef8d73..d3f36a6d886 100644 --- a/tests/lib/AppFramework/Http/RequestTest.php +++ b/tests/lib/AppFramework/Http/RequestTest.php @@ -40,7 +40,7 @@ class RequestTest extends \Test\TestCase { stream_wrapper_register('fakeinput', 'Test\AppFramework\Http\RequestStream'); $this->secureRandom = $this->getMockBuilder('\OCP\Security\ISecureRandom')->getMock(); - $this->config = $this->getMockBuilder('\OCP\IConfig')->getMock(); + $this->config = $this->getMockBuilder(IConfig::class)->getMock(); $this->csrfTokenManager = $this->getMockBuilder('\OC\Security\CSRF\CsrfTokenManager') ->disableOriginalConstructor()->getMock(); } diff --git a/tests/lib/AppFramework/Middleware/MiddlewareDispatcherTest.php b/tests/lib/AppFramework/Middleware/MiddlewareDispatcherTest.php index f948e184f53..e71be9c5f16 100644 --- a/tests/lib/AppFramework/Middleware/MiddlewareDispatcherTest.php +++ b/tests/lib/AppFramework/Middleware/MiddlewareDispatcherTest.php @@ -29,6 +29,7 @@ use OC\AppFramework\Middleware\MiddlewareDispatcher; use OCP\AppFramework\Controller; use OCP\AppFramework\Middleware; use OCP\AppFramework\Http\Response; +use OCP\IConfig; // needed to test ordering @@ -133,7 +134,7 @@ class MiddlewareDispatcherTest extends \Test\TestCase { new Request( ['method' => 'GET'], $this->getMockBuilder('\OCP\Security\ISecureRandom')->getMock(), - $this->getMockBuilder('\OCP\IConfig')->getMock() + $this->getMockBuilder(IConfig::class)->getMock() ) ])->getMock(); } diff --git a/tests/lib/AppFramework/Middleware/MiddlewareTest.php b/tests/lib/AppFramework/Middleware/MiddlewareTest.php index c5c812839b2..07028745676 100644 --- a/tests/lib/AppFramework/Middleware/MiddlewareTest.php +++ b/tests/lib/AppFramework/Middleware/MiddlewareTest.php @@ -27,6 +27,7 @@ namespace Test\AppFramework\Middleware; use OC\AppFramework\Http\Request; use OCP\AppFramework\Middleware; use OCP\AppFramework\Http\Response; +use OCP\IConfig; class ChildMiddleware extends Middleware {}; @@ -59,7 +60,7 @@ class MiddlewareTest extends \Test\TestCase { new Request( [], $this->getMockBuilder('\OCP\Security\ISecureRandom')->getMock(), - $this->getMockBuilder('\OCP\IConfig')->getMock() + $this->getMockBuilder(IConfig::class)->getMock() ) ])->getMock(); $this->exception = new \Exception(); diff --git a/tests/lib/AppFramework/Middleware/SessionMiddlewareTest.php b/tests/lib/AppFramework/Middleware/SessionMiddlewareTest.php index 3c218bb53c7..8d097e3a8a1 100644 --- a/tests/lib/AppFramework/Middleware/SessionMiddlewareTest.php +++ b/tests/lib/AppFramework/Middleware/SessionMiddlewareTest.php @@ -17,6 +17,7 @@ use OC\AppFramework\Middleware\SessionMiddleware; use OC\AppFramework\Utility\ControllerMethodReflector; use OCP\AppFramework\Controller; use OCP\AppFramework\Http\Response; +use OCP\IConfig; class SessionMiddlewareTest extends \Test\TestCase { @@ -36,7 +37,7 @@ class SessionMiddlewareTest extends \Test\TestCase { $this->request = new Request( [], $this->getMockBuilder('\OCP\Security\ISecureRandom')->getMock(), - $this->getMockBuilder('\OCP\IConfig')->getMock() + $this->getMockBuilder(IConfig::class)->getMock() ); $this->reflector = new ControllerMethodReflector(); $this->controller = $this->createMock(Controller::class); diff --git a/tests/lib/AppFramework/Routing/RoutingTest.php b/tests/lib/AppFramework/Routing/RoutingTest.php index d395584d011..76533fff014 100644 --- a/tests/lib/AppFramework/Routing/RoutingTest.php +++ b/tests/lib/AppFramework/Routing/RoutingTest.php @@ -5,6 +5,7 @@ namespace Test\AppFramework\Routing; use OC\AppFramework\DependencyInjection\DIContainer; use OC\AppFramework\Routing\RouteActionHandler; use OC\AppFramework\Routing\RouteConfig; +use OCP\ILogger; class RoutingTest extends \Test\TestCase { @@ -130,7 +131,7 @@ class RoutingTest extends \Test\TestCase // router mock $router = $this->getMockBuilder('\OC\Route\Router') ->setMethods(['create']) - ->setConstructorArgs([$this->getMockBuilder('\OCP\ILogger')->getMock()]) + ->setConstructorArgs([$this->getMockBuilder(ILogger::class)->getMock()]) ->getMock(); // load route configuration @@ -151,7 +152,7 @@ class RoutingTest extends \Test\TestCase // router mock $router = $this->getMockBuilder('\OC\Route\Router') ->setMethods(['create']) - ->setConstructorArgs([$this->getMockBuilder('\OCP\ILogger')->getMock()]) + ->setConstructorArgs([$this->getMockBuilder(ILogger::class)->getMock()]) ->getMock(); // load route configuration @@ -212,7 +213,7 @@ class RoutingTest extends \Test\TestCase // router mock $router = $this->getMockBuilder('\OC\Route\Router') ->setMethods(['create']) - ->setConstructorArgs([$this->getMockBuilder('\OCP\ILogger')->getMock()]) + ->setConstructorArgs([$this->getMockBuilder(ILogger::class)->getMock()]) ->getMock(); // we expect create to be called once: @@ -260,7 +261,7 @@ class RoutingTest extends \Test\TestCase // router mock $router = $this->getMockBuilder('\OC\Route\Router') ->setMethods(['create']) - ->setConstructorArgs([$this->getMockBuilder('\OCP\ILogger')->getMock()]) + ->setConstructorArgs([$this->getMockBuilder(ILogger::class)->getMock()]) ->getMock(); // we expect create to be called once: @@ -287,7 +288,7 @@ class RoutingTest extends \Test\TestCase // router mock $router = $this->getMockBuilder('\OC\Route\Router') ->setMethods(['create']) - ->setConstructorArgs([$this->getMockBuilder('\OCP\ILogger')->getMock()]) + ->setConstructorArgs([$this->getMockBuilder(ILogger::class)->getMock()]) ->getMock(); // route mocks diff --git a/tests/lib/BackgroundJob/JobTest.php b/tests/lib/BackgroundJob/JobTest.php index 7923eef11ef..ecd8bde8626 100644 --- a/tests/lib/BackgroundJob/JobTest.php +++ b/tests/lib/BackgroundJob/JobTest.php @@ -8,6 +8,8 @@ namespace Test\BackgroundJob; +use OCP\ILogger; + class JobTest extends \Test\TestCase { private $run = false; @@ -24,7 +26,7 @@ class JobTest extends \Test\TestCase { }); $jobList->add($job); - $logger = $this->getMockBuilder('OCP\ILogger') + $logger = $this->getMockBuilder(ILogger::class) ->disableOriginalConstructor() ->getMock(); $logger->expects($this->once()) diff --git a/tests/lib/CapabilitiesManagerTest.php b/tests/lib/CapabilitiesManagerTest.php index 139940eb306..8df385e6ef9 100644 --- a/tests/lib/CapabilitiesManagerTest.php +++ b/tests/lib/CapabilitiesManagerTest.php @@ -37,7 +37,7 @@ class CapabilitiesManagerTest extends TestCase { public function setUp() { parent::setUp(); - $this->logger = $this->getMockBuilder('OCP\ILogger')->getMock(); + $this->logger = $this->getMockBuilder(ILogger::class)->getMock(); $this->manager = new CapabilitiesManager($this->logger); } diff --git a/tests/lib/Encryption/DecryptAllTest.php b/tests/lib/Encryption/DecryptAllTest.php index 289e7de27ab..c52619c3b12 100644 --- a/tests/lib/Encryption/DecryptAllTest.php +++ b/tests/lib/Encryption/DecryptAllTest.php @@ -29,6 +29,7 @@ use OC\Encryption\Manager; use OC\Files\FileInfo; use OC\Files\View; use OCP\IUserManager; +use OCP\UserInterface; use Symfony\Component\Console\Formatter\OutputFormatterInterface; use Test\TestCase; @@ -65,7 +66,7 @@ class DecryptAllTest extends TestCase { public function setUp() { parent::setUp(); - $this->userManager = $this->getMockBuilder('OCP\IUserManager') + $this->userManager = $this->getMockBuilder(IUserManager::class) ->disableOriginalConstructor()->getMock(); $this->encryptionManager = $this->getMockBuilder('OC\Encryption\Manager') ->disableOriginalConstructor()->getMock(); @@ -75,7 +76,7 @@ class DecryptAllTest 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(); $this->outputInterface->expects($this->any())->method('getFormatter') diff --git a/tests/lib/Encryption/Keys/StorageTest.php b/tests/lib/Encryption/Keys/StorageTest.php index 4e9719351f3..a5924d1dc88 100644 --- a/tests/lib/Encryption/Keys/StorageTest.php +++ b/tests/lib/Encryption/Keys/StorageTest.php @@ -24,6 +24,7 @@ namespace Test\Encryption\Keys; use OC\Encryption\Keys\Storage; +use OCP\IConfig; use Test\TestCase; class StorageTest extends TestCase { @@ -51,7 +52,7 @@ class StorageTest extends TestCase { ->disableOriginalConstructor() ->getMock(); - $this->config = $this->getMockBuilder('OCP\IConfig') + $this->config = $this->getMockBuilder(IConfig::class) ->disableOriginalConstructor() ->getMock(); diff --git a/tests/lib/Encryption/UpdateTest.php b/tests/lib/Encryption/UpdateTest.php index b222bc42d7a..ccd2bb796fc 100644 --- a/tests/lib/Encryption/UpdateTest.php +++ b/tests/lib/Encryption/UpdateTest.php @@ -24,6 +24,7 @@ namespace Test\Encryption; use OC\Encryption\Update; +use OC\Files\View; use Test\TestCase; class UpdateTest extends TestCase { @@ -55,7 +56,7 @@ class UpdateTest extends TestCase { protected function setUp() { parent::setUp(); - $this->view = $this->getMockBuilder('\OC\Files\View') + $this->view = $this->getMockBuilder(View::class) ->disableOriginalConstructor()->getMock(); $this->util = $this->getMockBuilder('\OC\Encryption\Util') ->disableOriginalConstructor()->getMock(); diff --git a/tests/lib/Encryption/UtilTest.php b/tests/lib/Encryption/UtilTest.php index 609f6ae1e68..e313274516e 100644 --- a/tests/lib/Encryption/UtilTest.php +++ b/tests/lib/Encryption/UtilTest.php @@ -4,6 +4,7 @@ namespace Test\Encryption; use OC\Encryption\Util; use OCP\Encryption\IEncryptionModule; +use OCP\IConfig; use Test\TestCase; class UtilTest extends TestCase { @@ -44,7 +45,7 @@ class UtilTest extends TestCase { ->disableOriginalConstructor() ->getMock(); - $this->config = $this->getMockBuilder('OCP\IConfig') + $this->config = $this->getMockBuilder(IConfig::class) ->disableOriginalConstructor() ->getMock(); diff --git a/tests/lib/Files/Node/NodeTest.php b/tests/lib/Files/Node/NodeTest.php index 5e18caa2014..160787411f1 100644 --- a/tests/lib/Files/Node/NodeTest.php +++ b/tests/lib/Files/Node/NodeTest.php @@ -13,7 +13,10 @@ use OC\Files\View; use OCP\Files\Config\IUserMountCache; use OCP\Files\IRootFolder; use OCP\Files\Node; +use OCP\Files\Storage; +use OCP\IConfig; use OCP\ILogger; +use OCP\IURLGenerator; use OCP\IUserManager; use OCP\Files\NotFoundException; @@ -41,17 +44,18 @@ abstract class NodeTest extends \Test\TestCase { protected function setUp() { parent::setUp(); - $config = $this->getMockBuilder('\OCP\IConfig') + $config = $this->getMockBuilder(IConfig::class) ->disableOriginalConstructor() ->getMock(); - $urlGenerator = $this->getMockBuilder('\OCP\IURLGenerator') + $urlGenerator = $this->getMockBuilder(IURLGenerator + ::class) ->disableOriginalConstructor() ->getMock(); $this->user = new \OC\User\User('', new \Test\Util\User\Dummy, null, $config, $urlGenerator); $this->manager = $this->getMockBuilder('\OC\Files\Mount\Manager') ->disableOriginalConstructor() ->getMock(); - $this->view = $this->getMockBuilder('\OC\Files\View') + $this->view = $this->getMockBuilder(View::class) ->disableOriginalConstructor() ->getMock(); $this->userMountCache = $this->getMockBuilder('\OCP\Files\Config\IUserMountCache') @@ -88,7 +92,7 @@ abstract class NodeTest extends \Test\TestCase { protected abstract function getViewDeleteMethod(); protected function getMockStorage() { - $storage = $this->getMockBuilder('\OCP\Files\Storage') + $storage = $this->getMockBuilder(Storage::class) ->disableOriginalConstructor() ->getMock(); $storage->expects($this->any()) diff --git a/tests/lib/Files/Node/RootTest.php b/tests/lib/Files/Node/RootTest.php index fbc33cafcd8..2f81a96d486 100644 --- a/tests/lib/Files/Node/RootTest.php +++ b/tests/lib/Files/Node/RootTest.php @@ -13,7 +13,9 @@ use OC\Files\FileInfo; use OC\Files\Mount\Manager; use OC\Files\Node\Folder; use OC\Files\View; +use OCP\IConfig; use OCP\ILogger; +use OCP\IURLGenerator; use OCP\IUser; use OCP\IUserManager; @@ -37,10 +39,10 @@ class RootTest extends \Test\TestCase { protected function setUp() { parent::setUp(); - $config = $this->getMockBuilder('\OCP\IConfig') + $config = $this->getMockBuilder(IConfig::class) ->disableOriginalConstructor() ->getMock(); - $urlgenerator = $this->getMockBuilder('\OCP\IURLGenerator') + $urlgenerator = $this->getMockBuilder(IURLGenerator::class) ->disableOriginalConstructor() ->getMock(); @@ -69,7 +71,7 @@ class RootTest extends \Test\TestCase { /** * @var \OC\Files\View | \PHPUnit_Framework_MockObject_MockObject $view */ - $view = $this->getMockBuilder('\OC\Files\View') + $view = $this->getMockBuilder(View::class) ->disableOriginalConstructor() ->getMock(); $root = new \OC\Files\Node\Root( @@ -105,7 +107,7 @@ class RootTest extends \Test\TestCase { /** * @var \OC\Files\View | \PHPUnit_Framework_MockObject_MockObject $view */ - $view = $this->getMockBuilder('\OC\Files\View') + $view = $this->getMockBuilder(View::class) ->disableOriginalConstructor() ->getMock(); $root = new \OC\Files\Node\Root( @@ -133,7 +135,7 @@ class RootTest extends \Test\TestCase { /** * @var \OC\Files\View | \PHPUnit_Framework_MockObject_MockObject $view */ - $view = $this->getMockBuilder('\OC\Files\View') + $view = $this->getMockBuilder(View::class) ->disableOriginalConstructor() ->getMock(); $root = new \OC\Files\Node\Root( @@ -155,7 +157,7 @@ class RootTest extends \Test\TestCase { /** * @var \OC\Files\View | \PHPUnit_Framework_MockObject_MockObject $view */ - $view = $this->getMockBuilder('\OC\Files\View') + $view = $this->getMockBuilder(View::class) ->disableOriginalConstructor() ->getMock(); $root = new \OC\Files\Node\Root( diff --git a/tests/lib/Files/Storage/Wrapper/EncryptionTest.php b/tests/lib/Files/Storage/Wrapper/EncryptionTest.php index 80d62b16578..459abf3b64c 100644 --- a/tests/lib/Files/Storage/Wrapper/EncryptionTest.php +++ b/tests/lib/Files/Storage/Wrapper/EncryptionTest.php @@ -16,6 +16,7 @@ use OCP\Encryption\IFile; use OCP\Encryption\Keys\IStorage; use OCP\Files\Cache\ICache; use OCP\Files\Mount\IMountPoint; +use OCP\IConfig; use OCP\ILogger; use Test\Files\Storage\Storage; @@ -120,7 +121,7 @@ class EncryptionTest extends Storage { ->willReturn($mockModule); $this->arrayCache = $this->createMock(ArrayCache::class); - $this->config = $this->getMockBuilder('\OCP\IConfig') + $this->config = $this->getMockBuilder(IConfig::class) ->disableOriginalConstructor() ->getMock(); $this->groupManager = $this->getMockBuilder('\OC\Group\Manager') diff --git a/tests/lib/Files/Storage/Wrapper/QuotaTest.php b/tests/lib/Files/Storage/Wrapper/QuotaTest.php index ee01d0c3f26..b796e767a7b 100644 --- a/tests/lib/Files/Storage/Wrapper/QuotaTest.php +++ b/tests/lib/Files/Storage/Wrapper/QuotaTest.php @@ -185,7 +185,7 @@ class QuotaTest extends \Test\Files\Storage\Storage { } public function testSpaceRoot() { - $storage = $this->getMockBuilder('\OC\Files\Storage\Local')->disableOriginalConstructor()->getMock(); + $storage = $this->getMockBuilder(Local::class)->disableOriginalConstructor()->getMock(); $cache = $this->getMockBuilder('\OC\Files\Cache\Cache')->disableOriginalConstructor()->getMock(); $storage->expects($this->once()) ->method('getCache') diff --git a/tests/lib/Files/Stream/EncryptionTest.php b/tests/lib/Files/Stream/EncryptionTest.php index 1dc9dca0aad..983428ee51d 100644 --- a/tests/lib/Files/Stream/EncryptionTest.php +++ b/tests/lib/Files/Stream/EncryptionTest.php @@ -4,6 +4,7 @@ namespace Test\Files\Stream; use OC\Files\View; use OC\Memcache\ArrayCache; +use OCP\IConfig; class EncryptionTest extends \Test\TestCase { @@ -29,7 +30,7 @@ class EncryptionTest extends \Test\TestCase { ->disableOriginalConstructor()->getMock(); $encStorage = $this->getMockBuilder('\OC\Files\Storage\Wrapper\Encryption') ->disableOriginalConstructor()->getMock(); - $config = $this->getMockBuilder('\OCP\IConfig') + $config = $this->getMockBuilder(IConfig::class) ->disableOriginalConstructor() ->getMock(); $arrayCache = $this->createMock(ArrayCache::class); diff --git a/tests/lib/Files/Type/DetectionTest.php b/tests/lib/Files/Type/DetectionTest.php index 5c1f48a806e..295b9bf9fac 100644 --- a/tests/lib/Files/Type/DetectionTest.php +++ b/tests/lib/Files/Type/DetectionTest.php @@ -21,7 +21,8 @@ namespace Test\Files\Type; -use \OC\Files\Type\Detection; +use OC\Files\Type\Detection; +use OCP\IURLGenerator; class DetectionTest extends \Test\TestCase { /** @var Detection */ @@ -107,7 +108,7 @@ class DetectionTest extends \Test\TestCase { */ //Mock UrlGenerator - $urlGenerator = $this->getMockBuilder('\OCP\IURLGenerator') + $urlGenerator = $this->getMockBuilder(IURLGenerator::class) ->disableOriginalConstructor() ->getMock(); @@ -126,7 +127,7 @@ class DetectionTest extends \Test\TestCase { * Test dir-shareed mimetype */ //Mock UrlGenerator - $urlGenerator = $this->getMockBuilder('\OCP\IURLGenerator') + $urlGenerator = $this->getMockBuilder(IURLGenerator::class) ->disableOriginalConstructor() ->getMock(); @@ -146,7 +147,7 @@ class DetectionTest extends \Test\TestCase { */ //Mock UrlGenerator - $urlGenerator = $this->getMockBuilder('\OCP\IURLGenerator') + $urlGenerator = $this->getMockBuilder(IURLGenerator::class) ->disableOriginalConstructor() ->getMock(); @@ -166,7 +167,7 @@ class DetectionTest extends \Test\TestCase { */ //Mock UrlGenerator - $urlGenerator = $this->getMockBuilder('\OCP\IURLGenerator') + $urlGenerator = $this->getMockBuilder(IURLGenerator::class) ->disableOriginalConstructor() ->getMock(); @@ -186,7 +187,7 @@ class DetectionTest extends \Test\TestCase { */ //Mock UrlGenerator - $urlGenerator = $this->getMockBuilder('\OCP\IURLGenerator') + $urlGenerator = $this->getMockBuilder(IURLGenerator::class) ->disableOriginalConstructor() ->getMock(); @@ -216,7 +217,7 @@ class DetectionTest extends \Test\TestCase { */ //Mock UrlGenerator - $urlGenerator = $this->getMockBuilder('\OCP\IURLGenerator') + $urlGenerator = $this->getMockBuilder(IURLGenerator::class) ->disableOriginalConstructor() ->getMock(); @@ -246,7 +247,7 @@ class DetectionTest extends \Test\TestCase { */ //Mock UrlGenerator - $urlGenerator = $this->getMockBuilder('\OCP\IURLGenerator') + $urlGenerator = $this->getMockBuilder(IURLGenerator::class) ->disableOriginalConstructor() ->getMock(); @@ -272,7 +273,7 @@ class DetectionTest extends \Test\TestCase { $mimetypealiases_dist->setContent(json_encode(['foo' => 'foobar/baz'], JSON_FORCE_OBJECT)); //Mock UrlGenerator - $urlGenerator = $this->getMockBuilder('\OCP\IURLGenerator') + $urlGenerator = $this->getMockBuilder(IURLGenerator::class) ->disableOriginalConstructor() ->getMock(); diff --git a/tests/lib/Group/GroupTest.php b/tests/lib/Group/GroupTest.php index c1824566733..c7cbbc2321b 100644 --- a/tests/lib/Group/GroupTest.php +++ b/tests/lib/Group/GroupTest.php @@ -10,6 +10,8 @@ namespace Test\Group; use OC\User\User; +use OCP\IConfig; +use OCP\IURLGenerator; class GroupTest extends \Test\TestCase { @@ -19,10 +21,10 @@ class GroupTest extends \Test\TestCase { * @return User */ private function newUser($uid, \OC\User\Backend $backend) { - $config = $this->getMockBuilder('\OCP\IConfig') + $config = $this->getMockBuilder(IConfig::class) ->disableOriginalConstructor() ->getMock(); - $urlgenerator = $this->getMockBuilder('\OCP\IURLGenerator') + $urlgenerator = $this->getMockBuilder(IURLGenerator::class) ->disableOriginalConstructor() ->getMock(); diff --git a/tests/lib/HTTPHelperTest.php b/tests/lib/HTTPHelperTest.php index d241acb2f93..d39cc34c464 100644 --- a/tests/lib/HTTPHelperTest.php +++ b/tests/lib/HTTPHelperTest.php @@ -9,6 +9,7 @@ namespace Test; use OCP\Http\Client\IClientService; +use OCP\IConfig; class HTTPHelperTest extends \Test\TestCase { @@ -22,7 +23,7 @@ class HTTPHelperTest extends \Test\TestCase { protected function setUp() { parent::setUp(); - $this->config = $this->getMockBuilder('\OCP\IConfig') + $this->config = $this->getMockBuilder(IConfig::class) ->disableOriginalConstructor()->getMock(); $this->clientService = $this->createMock(IClientService::class); $this->httpHelperMock = $this->getMockBuilder('\OC\HTTPHelper') diff --git a/tests/lib/Memcache/FactoryTest.php b/tests/lib/Memcache/FactoryTest.php index 8607ea7de9b..ce6c25cd87f 100644 --- a/tests/lib/Memcache/FactoryTest.php +++ b/tests/lib/Memcache/FactoryTest.php @@ -20,6 +20,8 @@ */ namespace Test\Memcache; +use OCP\ILogger; + class Test_Factory_Available_Cache1 { public function __construct($prefix = '') { } @@ -114,7 +116,7 @@ class FactoryTest extends \Test\TestCase { */ public function testCacheAvailability($localCache, $distributedCache, $lockingCache, $expectedLocalCache, $expectedDistributedCache, $expectedLockingCache) { - $logger = $this->getMockBuilder('\OCP\ILogger')->getMock(); + $logger = $this->getMockBuilder(ILogger::class)->getMock(); $factory = new \OC\Memcache\Factory('abc', $logger, $localCache, $distributedCache, $lockingCache); $this->assertTrue(is_a($factory->createLocal(), $expectedLocalCache)); $this->assertTrue(is_a($factory->createDistributed(), $expectedDistributedCache)); @@ -126,7 +128,7 @@ class FactoryTest extends \Test\TestCase { * @expectedException \OC\HintException */ public function testCacheNotAvailableException($localCache, $distributedCache) { - $logger = $this->getMockBuilder('\OCP\ILogger')->getMock(); + $logger = $this->getMockBuilder(ILogger::class)->getMock(); new \OC\Memcache\Factory('abc', $logger, $localCache, $distributedCache); } } diff --git a/tests/lib/Migration/BackgroundRepairTest.php b/tests/lib/Migration/BackgroundRepairTest.php index 2de55f647e7..7a3a960074f 100644 --- a/tests/lib/Migration/BackgroundRepairTest.php +++ b/tests/lib/Migration/BackgroundRepairTest.php @@ -72,7 +72,7 @@ class BackgroundRepairTest extends TestCase { $this->jobList = $this->getMockBuilder('OC\BackgroundJob\JobList') ->disableOriginalConstructor() ->getMock(); - $this->logger = $this->getMockBuilder('OCP\ILogger') + $this->logger = $this->getMockBuilder(ILogger::class) ->disableOriginalConstructor() ->getMock(); $this->job = $this->getMockBuilder(BackgroundRepair::class) diff --git a/tests/lib/Notification/ManagerTest.php b/tests/lib/Notification/ManagerTest.php index e280838424b..cb6504b67e7 100644 --- a/tests/lib/Notification/ManagerTest.php +++ b/tests/lib/Notification/ManagerTest.php @@ -22,7 +22,10 @@ namespace Test\Notification; use OC\Notification\Manager; +use OCP\Notification\IApp; use OCP\Notification\IManager; +use OCP\Notification\INotification; +use OCP\Notification\INotifier; use OCP\RichObjectStrings\IValidator; use Test\TestCase; @@ -37,7 +40,7 @@ class ManagerTest extends TestCase { } public function testRegisterApp() { - $app = $this->getMockBuilder('OCP\Notification\IApp') + $app = $this->getMockBuilder(IApp::class) ->disableOriginalConstructor() ->getMock(); @@ -61,7 +64,7 @@ class ManagerTest extends TestCase { * @expectedException \InvalidArgumentException */ public function testRegisterAppInvalid() { - $notifier = $this->getMockBuilder('OCP\Notification\INotifier') + $notifier = $this->getMockBuilder(INotifier::class) ->disableOriginalConstructor() ->getMock(); @@ -75,7 +78,7 @@ class ManagerTest extends TestCase { } public function testRegisterNotifier() { - $notifier = $this->getMockBuilder('OCP\Notification\INotifier') + $notifier = $this->getMockBuilder(INotifier::class) ->disableOriginalConstructor() ->getMock(); @@ -107,7 +110,7 @@ class ManagerTest extends TestCase { * @expectedException \InvalidArgumentException */ public function testRegisterNotifierInvalid() { - $app = $this->getMockBuilder('OCP\Notification\IApp') + $app = $this->getMockBuilder(IApp::class) ->disableOriginalConstructor() ->getMock(); @@ -138,7 +141,7 @@ class ManagerTest extends TestCase { * @param mixed $data */ public function testRegisterNotifierInfoInvalid($data) { - $app = $this->getMockBuilder('OCP\Notification\IApp') + $app = $this->getMockBuilder(IApp::class) ->disableOriginalConstructor() ->getMock(); @@ -158,7 +161,7 @@ class ManagerTest extends TestCase { * @expectedExceptionMessage The given notifier ID test1 is already in use */ public function testRegisterNotifierInfoDuplicate() { - $app = $this->getMockBuilder('OCP\Notification\IApp') + $app = $this->getMockBuilder(IApp::class) ->disableOriginalConstructor() ->getMock(); @@ -184,7 +187,7 @@ class ManagerTest extends TestCase { public function testNotify() { /** @var \OCP\Notification\INotification|\PHPUnit_Framework_MockObject_MockObject $notification */ - $notification = $this->getMockBuilder('OCP\Notification\INotification') + $notification = $this->getMockBuilder(INotification::class) ->disableOriginalConstructor() ->getMock(); $notification->expects($this->once()) @@ -192,7 +195,7 @@ class ManagerTest extends TestCase { ->willReturn(true); /** @var \OCP\Notification\IApp|\PHPUnit_Framework_MockObject_MockObject $app */ - $app = $this->getMockBuilder('OCP\Notification\IApp') + $app = $this->getMockBuilder(IApp::class) ->disableOriginalConstructor() ->getMock(); $app->expects($this->once()) @@ -200,7 +203,7 @@ class ManagerTest extends TestCase { ->with($notification); /** @var \OCP\Notification\IApp|\PHPUnit_Framework_MockObject_MockObject $app2 */ - $app2 = $this->getMockBuilder('OCP\Notification\IApp') + $app2 = $this->getMockBuilder(IApp::class) ->disableOriginalConstructor() ->getMock(); $app2->expects($this->once()) @@ -222,7 +225,7 @@ class ManagerTest extends TestCase { */ public function testNotifyInvalid() { /** @var \OCP\Notification\INotification|\PHPUnit_Framework_MockObject_MockObject $notification */ - $notification = $this->getMockBuilder('OCP\Notification\INotification') + $notification = $this->getMockBuilder(INotification::class) ->disableOriginalConstructor() ->getMock(); $notification->expects($this->once()) @@ -234,14 +237,14 @@ class ManagerTest extends TestCase { public function testPrepare() { /** @var \OCP\Notification\INotification|\PHPUnit_Framework_MockObject_MockObject $notification */ - $notification = $this->getMockBuilder('OCP\Notification\INotification') + $notification = $this->getMockBuilder(INotification::class) ->disableOriginalConstructor() ->getMock(); $notification->expects($this->once()) ->method('isValidParsed') ->willReturn(true); /** @var \OCP\Notification\INotification|\PHPUnit_Framework_MockObject_MockObject $notification2 */ - $notification2 = $this->getMockBuilder('OCP\Notification\INotification') + $notification2 = $this->getMockBuilder(INotification::class) ->disableOriginalConstructor() ->getMock(); $notification2->expects($this->exactly(2)) @@ -249,7 +252,7 @@ class ManagerTest extends TestCase { ->willReturn(true); /** @var \OCP\Notification\IApp|\PHPUnit_Framework_MockObject_MockObject $notifier */ - $notifier = $this->getMockBuilder('OCP\Notification\INotifier') + $notifier = $this->getMockBuilder(INotifier::class) ->disableOriginalConstructor() ->getMock(); $notifier->expects($this->once()) @@ -258,7 +261,7 @@ class ManagerTest extends TestCase { ->willReturnArgument(0); /** @var \OCP\Notification\IApp|\PHPUnit_Framework_MockObject_MockObject $notifier2 */ - $notifier2 = $this->getMockBuilder('OCP\Notification\INotifier') + $notifier2 = $this->getMockBuilder(INotifier::class) ->disableOriginalConstructor() ->getMock(); $notifier2->expects($this->once()) @@ -285,7 +288,7 @@ class ManagerTest extends TestCase { */ public function testPrepareInvalid() { /** @var \OCP\Notification\INotification|\PHPUnit_Framework_MockObject_MockObject $notification */ - $notification = $this->getMockBuilder('OCP\Notification\INotification') + $notification = $this->getMockBuilder(INotification::class) ->disableOriginalConstructor() ->getMock(); $notification->expects($this->once()) @@ -293,7 +296,7 @@ class ManagerTest extends TestCase { ->willReturn(false); /** @var \OCP\Notification\IApp|\PHPUnit_Framework_MockObject_MockObject $notifier */ - $notifier = $this->getMockBuilder('OCP\Notification\INotifier') + $notifier = $this->getMockBuilder(INotifier::class) ->disableOriginalConstructor() ->getMock(); $notifier->expects($this->once()) @@ -312,7 +315,7 @@ class ManagerTest extends TestCase { public function testPrepareNotifierThrows() { /** @var \OCP\Notification\INotification|\PHPUnit_Framework_MockObject_MockObject $notification */ - $notification = $this->getMockBuilder('OCP\Notification\INotification') + $notification = $this->getMockBuilder(INotification::class) ->disableOriginalConstructor() ->getMock(); $notification->expects($this->once()) @@ -320,7 +323,7 @@ class ManagerTest extends TestCase { ->willReturn(true); /** @var \OCP\Notification\IApp|\PHPUnit_Framework_MockObject_MockObject $notifier */ - $notifier = $this->getMockBuilder('OCP\Notification\INotifier') + $notifier = $this->getMockBuilder(INotifier::class) ->disableOriginalConstructor() ->getMock(); $notifier->expects($this->once()) @@ -342,7 +345,7 @@ class ManagerTest extends TestCase { */ public function testPrepareNoNotifier() { /** @var \OCP\Notification\INotification|\PHPUnit_Framework_MockObject_MockObject $notification */ - $notification = $this->getMockBuilder('OCP\Notification\INotification') + $notification = $this->getMockBuilder(INotification::class) ->disableOriginalConstructor() ->getMock(); $notification->expects($this->once()) @@ -354,12 +357,12 @@ class ManagerTest extends TestCase { public function testMarkProcessed() { /** @var \OCP\Notification\INotification|\PHPUnit_Framework_MockObject_MockObject $notification */ - $notification = $this->getMockBuilder('OCP\Notification\INotification') + $notification = $this->getMockBuilder(INotification::class) ->disableOriginalConstructor() ->getMock(); /** @var \OCP\Notification\IApp|\PHPUnit_Framework_MockObject_MockObject $app */ - $app = $this->getMockBuilder('OCP\Notification\IApp') + $app = $this->getMockBuilder(IApp::class) ->disableOriginalConstructor() ->getMock(); $app->expects($this->once()) @@ -367,7 +370,7 @@ class ManagerTest extends TestCase { ->with($notification); /** @var \OCP\Notification\IApp|\PHPUnit_Framework_MockObject_MockObject $app2 */ - $app2 = $this->getMockBuilder('OCP\Notification\IApp') + $app2 = $this->getMockBuilder(IApp::class) ->disableOriginalConstructor() ->getMock(); $app2->expects($this->once()) @@ -386,12 +389,12 @@ class ManagerTest extends TestCase { public function testGetCount() { /** @var \OCP\Notification\INotification|\PHPUnit_Framework_MockObject_MockObject $notification */ - $notification = $this->getMockBuilder('OCP\Notification\INotification') + $notification = $this->getMockBuilder(INotification::class) ->disableOriginalConstructor() ->getMock(); /** @var \OCP\Notification\IApp|\PHPUnit_Framework_MockObject_MockObject $app */ - $app = $this->getMockBuilder('OCP\Notification\IApp') + $app = $this->getMockBuilder(IApp::class) ->disableOriginalConstructor() ->getMock(); $app->expects($this->once()) @@ -400,7 +403,7 @@ class ManagerTest extends TestCase { ->willReturn(21); /** @var \OCP\Notification\IApp|\PHPUnit_Framework_MockObject_MockObject $app2 */ - $app2 = $this->getMockBuilder('OCP\Notification\IApp') + $app2 = $this->getMockBuilder(IApp::class) ->disableOriginalConstructor() ->getMock(); $app2->expects($this->once()) diff --git a/tests/lib/Repair/CleanTagsTest.php b/tests/lib/Repair/CleanTagsTest.php index ac79907c525..115bce49f71 100644 --- a/tests/lib/Repair/CleanTagsTest.php +++ b/tests/lib/Repair/CleanTagsTest.php @@ -8,6 +8,7 @@ namespace Test\Repair; use OCP\DB\QueryBuilder\IQueryBuilder; +use OCP\IUserManager; use OCP\Migration\IOutput; /** @@ -41,7 +42,7 @@ class CleanTagsTest extends \Test\TestCase { ->disableOriginalConstructor() ->getMock(); - $this->userManager = $this->getMockBuilder('\OCP\IUserManager') + $this->userManager = $this->getMockBuilder(IUserManager::class) ->disableOriginalConstructor() ->getMock(); diff --git a/tests/lib/Repair/RepairInvalidSharesTest.php b/tests/lib/Repair/RepairInvalidSharesTest.php index fa75f58472a..0c67cc992ef 100644 --- a/tests/lib/Repair/RepairInvalidSharesTest.php +++ b/tests/lib/Repair/RepairInvalidSharesTest.php @@ -11,6 +11,7 @@ namespace Test\Repair; use OC\Repair\RepairInvalidShares; use OC\Share\Constants; +use OCP\IConfig; use OCP\Migration\IOutput; use OCP\Migration\IRepairStep; use Test\TestCase; @@ -33,7 +34,7 @@ class RepairInvalidSharesTest extends TestCase { protected function setUp() { parent::setUp(); - $config = $this->getMockBuilder('OCP\IConfig') + $config = $this->getMockBuilder(IConfig::class) ->disableOriginalConstructor() ->getMock(); $config->expects($this->any()) diff --git a/tests/lib/Repair/RepairMimeTypesTest.php b/tests/lib/Repair/RepairMimeTypesTest.php index 6f3ed5ce318..b9d73d27d00 100644 --- a/tests/lib/Repair/RepairMimeTypesTest.php +++ b/tests/lib/Repair/RepairMimeTypesTest.php @@ -39,7 +39,7 @@ class RepairMimeTypesTest extends \Test\TestCase { $this->mimetypeLoader = \OC::$server->getMimeTypeLoader(); /** @var IConfig | \PHPUnit_Framework_MockObject_MockObject $config */ - $config = $this->getMockBuilder('OCP\IConfig') + $config = $this->getMockBuilder(IConfig::class) ->disableOriginalConstructor() ->getMock(); $config->expects($this->any()) diff --git a/tests/lib/Security/CSRF/TokenStorage/SessionStorageTest.php b/tests/lib/Security/CSRF/TokenStorage/SessionStorageTest.php index d1e76684507..92a6557f8e3 100644 --- a/tests/lib/Security/CSRF/TokenStorage/SessionStorageTest.php +++ b/tests/lib/Security/CSRF/TokenStorage/SessionStorageTest.php @@ -31,7 +31,7 @@ class SessionStorageTest extends \Test\TestCase { public function setUp() { parent::setUp(); - $this->session = $this->getMockBuilder('\OCP\ISession') + $this->session = $this->getMockBuilder(ISession::class) ->disableOriginalConstructor()->getMock(); $this->sessionStorage = new \OC\Security\CSRF\TokenStorage\SessionStorage($this->session); } diff --git a/tests/lib/Security/HasherTest.php b/tests/lib/Security/HasherTest.php index 913f4d703e8..5f7613a823d 100644 --- a/tests/lib/Security/HasherTest.php +++ b/tests/lib/Security/HasherTest.php @@ -9,6 +9,7 @@ namespace Test\Security; use OC\Security\Hasher; +use OCP\IConfig; /** * Class HasherTest @@ -75,13 +76,13 @@ class HasherTest extends \Test\TestCase { /** @var Hasher */ protected $hasher; - /** @var \OCP\IConfig */ + /** @var IConfig */ protected $config; protected function setUp() { parent::setUp(); - $this->config = $this->getMockBuilder('\OCP\IConfig') + $this->config = $this->getMockBuilder(IConfig::class) ->disableOriginalConstructor()->getMock(); $this->hasher = new Hasher($this->config); diff --git a/tests/lib/Security/TrustedDomainHelperTest.php b/tests/lib/Security/TrustedDomainHelperTest.php index 1beb7a66717..25586a1bc27 100644 --- a/tests/lib/Security/TrustedDomainHelperTest.php +++ b/tests/lib/Security/TrustedDomainHelperTest.php @@ -21,7 +21,7 @@ class TrustedDomainHelperTest extends \Test\TestCase { protected function setUp() { parent::setUp(); - $this->config = $this->getMockBuilder('\OCP\IConfig')->getMock(); + $this->config = $this->getMockBuilder(IConfig::class)->getMock(); } /** diff --git a/tests/lib/Settings/Admin/AdditionalTest.php b/tests/lib/Settings/Admin/AdditionalTest.php index 84c63f3aeb1..4a254da060b 100644 --- a/tests/lib/Settings/Admin/AdditionalTest.php +++ b/tests/lib/Settings/Admin/AdditionalTest.php @@ -36,7 +36,7 @@ class AdditionalTest extends TestCase { public function setUp() { parent::setUp(); - $this->config = $this->getMockBuilder('\OCP\IConfig')->getMock(); + $this->config = $this->getMockBuilder(IConfig::class)->getMock(); $this->admin = new Additional( $this->config diff --git a/tests/lib/Settings/Admin/EncryptionTest.php b/tests/lib/Settings/Admin/EncryptionTest.php index a5f483863e6..41196a9bc41 100644 --- a/tests/lib/Settings/Admin/EncryptionTest.php +++ b/tests/lib/Settings/Admin/EncryptionTest.php @@ -40,7 +40,7 @@ class EncryptionTest extends TestCase { public function setUp() { parent::setUp(); $this->manager = $this->getMockBuilder('\OC\Encryption\Manager')->disableOriginalConstructor()->getMock(); - $this->userManager = $this->getMockBuilder('\OCP\IUserManager')->getMock(); + $this->userManager = $this->getMockBuilder(IUserManager::class)->getMock(); $this->admin = new Encryption( $this->manager, diff --git a/tests/lib/Settings/Admin/ServerTest.php b/tests/lib/Settings/Admin/ServerTest.php index 106390f25a5..b8317540117 100644 --- a/tests/lib/Settings/Admin/ServerTest.php +++ b/tests/lib/Settings/Admin/ServerTest.php @@ -49,11 +49,11 @@ class ServerTest extends TestCase { public function setUp() { parent::setUp(); - $this->config = $this->getMockBuilder('\OCP\IConfig')->getMock(); + $this->config = $this->getMockBuilder(IConfig::class)->getMock(); $this->request = $this->createMock(IRequest::class); $this->dbConnection = $this->getMockBuilder('\OCP\IDBConnection')->getMock(); $this->lockingProvider = $this->getMockBuilder('\OCP\Lock\ILockingProvider')->getMock(); - $this->l10n = $this->getMockBuilder('\OCP\IL10N')->getMock(); + $this->l10n = $this->getMockBuilder(IL10N::class)->getMock(); $this->admin = new Server( $this->dbConnection, diff --git a/tests/lib/Settings/Admin/SharingTest.php b/tests/lib/Settings/Admin/SharingTest.php index d9aa14fecea..9498a1466d3 100644 --- a/tests/lib/Settings/Admin/SharingTest.php +++ b/tests/lib/Settings/Admin/SharingTest.php @@ -36,7 +36,7 @@ class SharingTest extends TestCase { public function setUp() { parent::setUp(); - $this->config = $this->getMockBuilder('\OCP\IConfig')->getMock(); + $this->config = $this->getMockBuilder(IConfig::class)->getMock(); $this->admin = new Sharing( $this->config diff --git a/tests/lib/Settings/Admin/TipsTricksTest.php b/tests/lib/Settings/Admin/TipsTricksTest.php index cbecd51ed55..2bbadab52cb 100644 --- a/tests/lib/Settings/Admin/TipsTricksTest.php +++ b/tests/lib/Settings/Admin/TipsTricksTest.php @@ -36,7 +36,7 @@ class TipsTrickTest extends TestCase { public function setUp() { parent::setUp(); - $this->config = $this->getMockBuilder('\OCP\IConfig')->getMock(); + $this->config = $this->getMockBuilder(IConfig::class)->getMock(); $this->admin = new TipsTricks( $this->config diff --git a/tests/lib/SystemTag/SystemTagManagerTest.php b/tests/lib/SystemTag/SystemTagManagerTest.php index 61fac99ca6c..f81bbaf1643 100644 --- a/tests/lib/SystemTag/SystemTagManagerTest.php +++ b/tests/lib/SystemTag/SystemTagManagerTest.php @@ -13,6 +13,7 @@ namespace Test\SystemTag; use OC\SystemTag\SystemTagManager; use OC\SystemTag\SystemTagObjectMapper; use OCP\IDBConnection; +use OCP\IUser; use OCP\SystemTag\ISystemTag; use OCP\SystemTag\ISystemTagManager; use Symfony\Component\EventDispatcher\EventDispatcherInterface; @@ -56,7 +57,7 @@ class SystemTagManagerTest extends TestCase { $this->dispatcher = $this->getMockBuilder('Symfony\Component\EventDispatcher\EventDispatcherInterface') ->getMock(); - $this->groupManager = $this->getMockBuilder('\OCP\IGroupManager')->getMock(); + $this->groupManager = $this->getMockBuilder(IGroupManager::class)->getMock(); $this->tagManager = new SystemTagManager( $this->connection, @@ -433,7 +434,7 @@ class SystemTagManagerTest extends TestCase { * @dataProvider visibilityCheckProvider */ public function testVisibilityCheck($userVisible, $userAssignable, $isAdmin, $expectedResult) { - $user = $this->getMockBuilder('\OCP\IUser')->getMock(); + $user = $this->getMockBuilder(IUser::class)->getMock(); $user->expects($this->any()) ->method('getUID') ->will($this->returnValue('test')); @@ -480,7 +481,7 @@ class SystemTagManagerTest extends TestCase { * @dataProvider assignabilityCheckProvider */ public function testAssignabilityCheck($userVisible, $userAssignable, $isAdmin, $expectedResult, $userGroupIds = [], $tagGroupIds = []) { - $user = $this->getMockBuilder('\OCP\IUser')->getMock(); + $user = $this->getMockBuilder(IUser::class)->getMock(); $user->expects($this->any()) ->method('getUID') ->will($this->returnValue('test')); diff --git a/tests/lib/TestCase.php b/tests/lib/TestCase.php index 818b3454c3a..64036084dc2 100644 --- a/tests/lib/TestCase.php +++ b/tests/lib/TestCase.php @@ -491,7 +491,7 @@ abstract class TestCase extends \PHPUnit_Framework_TestCase { ->method('getName') ->willReturn('Nextcloud'); /** @var IL10N|\PHPUnit_Framework_MockObject_MockObject $l10n */ - $l10n = $this->getMockBuilder('\OCP\IL10N') + $l10n = $this->getMockBuilder(IL10N::class) ->disableOriginalConstructor()->getMock(); $l10n ->expects($this->any()) diff --git a/tests/lib/Updater/VersionCheckTest.php b/tests/lib/Updater/VersionCheckTest.php index 6f6c6c1ad0c..ff04aa17681 100644 --- a/tests/lib/Updater/VersionCheckTest.php +++ b/tests/lib/Updater/VersionCheckTest.php @@ -23,6 +23,7 @@ namespace Test\Updater; use OC\Updater\VersionCheck; +use OCP\Http\Client\IClientService; use OCP\IConfig; use OCP\Util; @@ -34,10 +35,10 @@ class VersionCheckTest extends \Test\TestCase { public function setUp() { parent::setUp(); - $this->config = $this->getMockBuilder('\OCP\IConfig') + $this->config = $this->getMockBuilder(IConfig::class) ->disableOriginalConstructor() ->getMock(); - $clientService = $this->getMockBuilder('\OCP\Http\Client\IClientService') + $clientService = $this->getMockBuilder(IClientService::class) ->disableOriginalConstructor() ->getMock(); diff --git a/tests/lib/User/ManagerTest.php b/tests/lib/User/ManagerTest.php index 9520cd640fd..0d98a9825de 100644 --- a/tests/lib/User/ManagerTest.php +++ b/tests/lib/User/ManagerTest.php @@ -615,7 +615,7 @@ class ManagerTest extends TestCase { } public function testDeleteUser() { - $config = $this->getMockBuilder('OCP\IConfig') + $config = $this->getMockBuilder(IConfig::class) ->disableOriginalConstructor() ->getMock(); $config diff --git a/tests/lib/User/SessionTest.php b/tests/lib/User/SessionTest.php index c4d29b979ae..9cbac8dfc29 100644 --- a/tests/lib/User/SessionTest.php +++ b/tests/lib/User/SessionTest.php @@ -769,7 +769,7 @@ class SessionTest extends \Test\TestCase { $session = new Memory(''); $session->set('user_id', 'foo'); - $userSession = $this->getMockBuilder('\OC\User\Session') + $userSession = $this->getMockBuilder(Session::class) ->setConstructorArgs([$manager, $session, $this->timeFactory, $this->tokenProvider, $this->config, $this->random, $this->lockdownManager]) ->setMethods([ 'validateSession' @@ -950,7 +950,7 @@ class SessionTest extends \Test\TestCase { $token->setUid('fritz0'); $token->setLastCheck(100); // Needs check $user = $this->createMock(IUser::class); - $userSession = $this->getMockBuilder('\OC\User\Session') + $userSession = $this->getMockBuilder(Session::class) ->setMethods(['logout']) ->setConstructorArgs([$manager, $session, $this->timeFactory, $this->tokenProvider, $this->config, $this->random, $this->lockdownManager]) ->getMock(); @@ -980,7 +980,7 @@ class SessionTest extends \Test\TestCase { $session = $this->createMock(ISession::class); $timeFactory = $this->createMock(ITimeFactory::class); $tokenProvider = $this->createMock(IProvider::class); - $userSession = $this->getMockBuilder('\OC\User\Session') + $userSession = $this->getMockBuilder(Session::class) ->setConstructorArgs([$userManager, $session, $timeFactory, $tokenProvider, $this->config, $this->random, $this->lockdownManager]) ->setMethods(['logout']) ->getMock(); @@ -1027,7 +1027,7 @@ class SessionTest extends \Test\TestCase { $session = $this->createMock(ISession::class); $timeFactory = $this->createMock(ITimeFactory::class); $tokenProvider = $this->createMock(IProvider::class); - $userSession = $this->getMockBuilder('\OC\User\Session') + $userSession = $this->getMockBuilder(Session::class) ->setConstructorArgs([$userManager, $session, $timeFactory, $tokenProvider, $this->config, $this->random, $this->lockdownManager]) ->setMethods(['logout']) ->getMock(); diff --git a/tests/lib/User/UserTest.php b/tests/lib/User/UserTest.php index 089f30a1fef..acb171d92e3 100644 --- a/tests/lib/User/UserTest.php +++ b/tests/lib/User/UserTest.php @@ -276,7 +276,7 @@ class UserTest extends TestCase { ->method('implementsActions') ->will($this->returnValue(false)); - $allConfig = $this->getMockBuilder('\OCP\IConfig') + $allConfig = $this->getMockBuilder(IConfig::class) ->disableOriginalConstructor() ->getMock(); $allConfig->expects($this->any()) diff --git a/tests/lib/UtilTest.php b/tests/lib/UtilTest.php index 52d18571647..49dc4ddebb1 100644 --- a/tests/lib/UtilTest.php +++ b/tests/lib/UtilTest.php @@ -10,6 +10,8 @@ namespace Test; use OC_Util; use OCP\App\IAppManager; +use OCP\IConfig; +use OCP\IUser; /** * Class UtilTest @@ -259,9 +261,9 @@ class UtilTest extends \Test\TestCase { * @param bool $expected expected result */ function testIsSharingDisabledForUser($groups, $membership, $excludedGroups, $expected) { - $config = $this->getMockBuilder('OCP\IConfig')->disableOriginalConstructor()->getMock(); + $config = $this->getMockBuilder(IConfig::class)->disableOriginalConstructor()->getMock(); $groupManager = $this->getMockBuilder('OCP\IGroupManager')->disableOriginalConstructor()->getMock(); - $user = $this->getMockBuilder('OCP\IUser')->disableOriginalConstructor()->getMock(); + $user = $this->getMockBuilder(IUser::class)->disableOriginalConstructor()->getMock(); $config ->expects($this->at(0)) |