aboutsummaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorChristopher Ng <chrng8@gmail.com>2024-10-08 16:44:06 -0700
committerChristopher Ng <chrng8@gmail.com>2024-10-08 17:16:56 -0700
commit96035d2de300e6dbdd7e99d8cc323d894d1777ec (patch)
tree2e203694bdf89046ba1b74d5cb8d2e3a6928aa39 /apps
parent1dcdc87b449a2241d3b715e7eb280e049609b723 (diff)
downloadnextcloud-server-96035d2de300e6dbdd7e99d8cc323d894d1777ec.tar.gz
nextcloud-server-96035d2de300e6dbdd7e99d8cc323d894d1777ec.zip
Signed-off-by: Christopher Ng <chrng8@gmail.com>
Diffstat (limited to 'apps')
-rw-r--r--apps/provisioning_api/tests/Controller/GroupsControllerTest.php10
-rw-r--r--apps/provisioning_api/tests/Controller/UsersControllerTest.php20
2 files changed, 13 insertions, 17 deletions
diff --git a/apps/provisioning_api/tests/Controller/GroupsControllerTest.php b/apps/provisioning_api/tests/Controller/GroupsControllerTest.php
index f9c0848fb72..5ddf5d7eff8 100644
--- a/apps/provisioning_api/tests/Controller/GroupsControllerTest.php
+++ b/apps/provisioning_api/tests/Controller/GroupsControllerTest.php
@@ -8,10 +8,10 @@
namespace OCA\Provisioning_API\Tests\Controller;
use OC\Group\Manager;
-use OC\SubAdmin;
use OC\User\NoUserException;
use OCA\Provisioning_API\Controller\GroupsController;
use OCP\Accounts\IAccountManager;
+use OCP\Group\ISubAdmin;
use OCP\IConfig;
use OCP\IRequest;
use OCP\IUser;
@@ -34,12 +34,12 @@ class GroupsControllerTest extends \Test\TestCase {
protected $userSession;
/** @var IAccountManager|\PHPUnit\Framework\MockObject\MockObject */
protected $accountManager;
+ /** @var ISubAdmin|\PHPUnit\Framework\MockObject\MockObject */
+ protected $subAdminManager;
/** @var IFactory|\PHPUnit\Framework\MockObject\MockObject */
protected $l10nFactory;
/** @var LoggerInterface|\PHPUnit\Framework\MockObject\MockObject */
protected $logger;
- /** @var SubAdmin|\PHPUnit\Framework\MockObject\MockObject */
- protected $subAdminManager;
/** @var GroupsController|\PHPUnit\Framework\MockObject\MockObject */
protected $api;
@@ -54,11 +54,10 @@ class GroupsControllerTest extends \Test\TestCase {
$this->groupManager = $this->createMock(Manager::class);
$this->userSession = $this->createMock(IUserSession::class);
$this->accountManager = $this->createMock(IAccountManager::class);
+ $this->subAdminManager = $this->createMock(ISubAdmin::class);
$this->l10nFactory = $this->createMock(IFactory::class);
$this->logger = $this->createMock(LoggerInterface::class);
- $this->subAdminManager = $this->createMock(SubAdmin::class);
-
$this->groupManager
->method('getSubAdmin')
->willReturn($this->subAdminManager);
@@ -72,6 +71,7 @@ class GroupsControllerTest extends \Test\TestCase {
$this->groupManager,
$this->userSession,
$this->accountManager,
+ $this->subAdminManager,
$this->l10nFactory,
$this->logger
])
diff --git a/apps/provisioning_api/tests/Controller/UsersControllerTest.php b/apps/provisioning_api/tests/Controller/UsersControllerTest.php
index d0d7dc72855..2ccb1196fbb 100644
--- a/apps/provisioning_api/tests/Controller/UsersControllerTest.php
+++ b/apps/provisioning_api/tests/Controller/UsersControllerTest.php
@@ -23,6 +23,7 @@ use OCP\Accounts\IAccountPropertyCollection;
use OCP\AppFramework\Http\DataResponse;
use OCP\AppFramework\OCS\OCSException;
use OCP\EventDispatcher\IEventDispatcher;
+use OCP\Group\ISubAdmin;
use OCP\IConfig;
use OCP\IGroup;
use OCP\IL10N;
@@ -57,6 +58,8 @@ class UsersControllerTest extends TestCase {
protected $api;
/** @var IAccountManager|MockObject */
protected $accountManager;
+ /** @var ISubAdmin|MockObject */
+ protected $subAdminManager;
/** @var IURLGenerator|MockObject */
protected $urlGenerator;
/** @var IRequest|MockObject */
@@ -86,6 +89,7 @@ class UsersControllerTest extends TestCase {
$this->logger = $this->createMock(LoggerInterface::class);
$this->request = $this->createMock(IRequest::class);
$this->accountManager = $this->createMock(IAccountManager::class);
+ $this->subAdminManager = $this->createMock(ISubAdmin::class);
$this->urlGenerator = $this->createMock(IURLGenerator::class);
$this->l10nFactory = $this->createMock(IFactory::class);
$this->newUserMailHelper = $this->createMock(NewUserMailHelper::class);
@@ -108,6 +112,7 @@ class UsersControllerTest extends TestCase {
$this->groupManager,
$this->userSession,
$this->accountManager,
+ $this->subAdminManager,
$this->l10nFactory,
$this->urlGenerator,
$this->logger,
@@ -376,6 +381,7 @@ class UsersControllerTest extends TestCase {
$this->groupManager,
$this->userSession,
$this->accountManager,
+ $this->subAdminManager,
$this->l10nFactory,
$this->urlGenerator,
$this->logger,
@@ -931,7 +937,6 @@ class UsersControllerTest extends TestCase {
->disableOriginalConstructor()
->getMock();
$loggedInUser
- ->expects($this->exactly(2))
->method('getUID')
->willReturn('admin');
$targetUser = $this->getMockBuilder(IUser::class)
@@ -941,16 +946,13 @@ class UsersControllerTest extends TestCase {
->method('getSystemEMailAddress')
->willReturn('demo@nextcloud.com');
$this->userSession
- ->expects($this->once())
->method('getUser')
->willReturn($loggedInUser);
$this->userManager
- ->expects($this->exactly(2))
->method('get')
->with('UID')
->willReturn($targetUser);
$this->groupManager
- ->expects($this->once())
->method('isAdmin')
->with('admin')
->willReturn(true);
@@ -1079,7 +1081,6 @@ class UsersControllerTest extends TestCase {
->disableOriginalConstructor()
->getMock();
$loggedInUser
- ->expects($this->exactly(2))
->method('getUID')
->willReturn('subadmin');
$targetUser = $this->getMockBuilder(IUser::class)
@@ -1090,16 +1091,13 @@ class UsersControllerTest extends TestCase {
->method('getSystemEMailAddress')
->willReturn('demo@nextcloud.com');
$this->userSession
- ->expects($this->once())
->method('getUser')
->willReturn($loggedInUser);
$this->userManager
- ->expects($this->exactly(2))
->method('get')
->with('UID')
->willReturn($targetUser);
$this->groupManager
- ->expects($this->once())
->method('isAdmin')
->with('subadmin')
->willReturn(false);
@@ -1267,23 +1265,19 @@ class UsersControllerTest extends TestCase {
->disableOriginalConstructor()
->getMock();
$loggedInUser
- ->expects($this->exactly(3))
->method('getUID')
->willReturn('UID');
$targetUser = $this->getMockBuilder(IUser::class)
->disableOriginalConstructor()
->getMock();
$this->userSession
- ->expects($this->once())
->method('getUser')
->willReturn($loggedInUser);
$this->userManager
- ->expects($this->exactly(2))
->method('get')
->with('UID')
->willReturn($targetUser);
$this->groupManager
- ->expects($this->once())
->method('isAdmin')
->with('UID')
->willReturn(false);
@@ -3667,6 +3661,7 @@ class UsersControllerTest extends TestCase {
$this->groupManager,
$this->userSession,
$this->accountManager,
+ $this->subAdminManager,
$this->l10nFactory,
$this->urlGenerator,
$this->logger,
@@ -3756,6 +3751,7 @@ class UsersControllerTest extends TestCase {
$this->groupManager,
$this->userSession,
$this->accountManager,
+ $this->subAdminManager,
$this->l10nFactory,
$this->urlGenerator,
$this->logger,