summaryrefslogtreecommitdiffstats
path: root/tests/Settings
diff options
context:
space:
mode:
Diffstat (limited to 'tests/Settings')
-rw-r--r--tests/Settings/Controller/AdminSettingsControllerTest.php9
-rw-r--r--tests/Settings/Controller/CertificateControllerTest.php4
-rw-r--r--tests/Settings/Controller/CheckSetupControllerTest.php12
-rw-r--r--tests/Settings/Controller/EncryptionControllerTest.php22
-rw-r--r--tests/Settings/Controller/GroupsControllerTest.php19
-rw-r--r--tests/Settings/Controller/UsersControllerTest.php96
-rw-r--r--tests/Settings/Middleware/SubadminMiddlewareTest.php4
7 files changed, 86 insertions, 80 deletions
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);