aboutsummaryrefslogtreecommitdiffstats
path: root/apps/provisioning_api/tests
diff options
context:
space:
mode:
authorRobin Appelman <robin@icewind.nl>2024-11-25 17:30:32 +0100
committerRobin Appelman <robin@icewind.nl>2025-01-16 17:06:04 +0100
commit3a2b3c75f20d1bd2ac22d79a4372c6c5c0b5fa2f (patch)
tree8e04572682efd8693046fde97d9492cc81c07aec /apps/provisioning_api/tests
parent8998e77c9d35d1c6183ac5d47f8e1ee9cdefa77f (diff)
downloadnextcloud-server-ocs-user-info-quota-optimize.tar.gz
nextcloud-server-ocs-user-info-quota-optimize.zip
perf: use more optimized way to get user storage info in ocs user info when possibleocs-user-info-quota-optimize
Signed-off-by: Robin Appelman <robin@icewind.nl>
Diffstat (limited to 'apps/provisioning_api/tests')
-rw-r--r--apps/provisioning_api/tests/Controller/GroupsControllerTest.php5
-rw-r--r--apps/provisioning_api/tests/Controller/UsersControllerTest.php13
2 files changed, 15 insertions, 3 deletions
diff --git a/apps/provisioning_api/tests/Controller/GroupsControllerTest.php b/apps/provisioning_api/tests/Controller/GroupsControllerTest.php
index b1a708b9aa2..29b098429e8 100644
--- a/apps/provisioning_api/tests/Controller/GroupsControllerTest.php
+++ b/apps/provisioning_api/tests/Controller/GroupsControllerTest.php
@@ -12,6 +12,7 @@ use OC\User\NoUserException;
use OCA\Provisioning_API\Controller\GroupsController;
use OCP\Accounts\IAccountManager;
use OCP\AppFramework\OCS\OCSException;
+use OCP\Files\IRootFolder;
use OCP\Group\ISubAdmin;
use OCP\IConfig;
use OCP\IGroup;
@@ -46,6 +47,8 @@ class GroupsControllerTest extends \Test\TestCase {
/** @var GroupsController|\PHPUnit\Framework\MockObject\MockObject */
protected $api;
+ private IRootFolder $rootFolder;
+
protected function setUp(): void {
parent::setUp();
@@ -59,6 +62,7 @@ class GroupsControllerTest extends \Test\TestCase {
$this->subAdminManager = $this->createMock(ISubAdmin::class);
$this->l10nFactory = $this->createMock(IFactory::class);
$this->logger = $this->createMock(LoggerInterface::class);
+ $this->rootFolder = $this->createMock(IRootFolder::class);
$this->groupManager
->method('getSubAdmin')
@@ -75,6 +79,7 @@ class GroupsControllerTest extends \Test\TestCase {
$this->accountManager,
$this->subAdminManager,
$this->l10nFactory,
+ $this->rootFolder,
$this->logger
])
->setMethods(['fillStorageInfo'])
diff --git a/apps/provisioning_api/tests/Controller/UsersControllerTest.php b/apps/provisioning_api/tests/Controller/UsersControllerTest.php
index 52dd82069f9..439ee0be250 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\Files\IRootFolder;
use OCP\Group\ISubAdmin;
use OCP\IConfig;
use OCP\IGroup;
@@ -76,6 +77,7 @@ class UsersControllerTest extends TestCase {
private $knownUserService;
/** @var IEventDispatcher|MockObject */
private $eventDispatcher;
+ private IRootFolder $rootFolder;
/** @var IPhoneNumberUtil */
private $phoneNumberUtil;
@@ -98,6 +100,7 @@ class UsersControllerTest extends TestCase {
$this->knownUserService = $this->createMock(KnownUserService::class);
$this->eventDispatcher = $this->createMock(IEventDispatcher::class);
$this->phoneNumberUtil = new PhoneNumberUtil();
+ $this->rootFolder = $this->createMock(IRootFolder::class);
$l10n = $this->createMock(IL10N::class);
$l10n->method('t')->willReturnCallback(fn (string $txt, array $replacement = []) => sprintf($txt, ...$replacement));
@@ -114,6 +117,7 @@ class UsersControllerTest extends TestCase {
$this->accountManager,
$this->subAdminManager,
$this->l10nFactory,
+ $this->rootFolder,
$this->urlGenerator,
$this->logger,
$this->newUserMailHelper,
@@ -508,6 +512,7 @@ class UsersControllerTest extends TestCase {
$this->accountManager,
$this->subAdminManager,
$this->l10nFactory,
+ $this->rootFolder,
$this->urlGenerator,
$this->logger,
$this->newUserMailHelper,
@@ -1127,7 +1132,7 @@ class UsersControllerTest extends TestCase {
$this->api
->expects($this->once())
->method('fillStorageInfo')
- ->with('UID')
+ ->with($targetUser)
->willReturn(['DummyValue']);
$backend = $this->createMock(UserInterface::class);
@@ -1260,7 +1265,7 @@ class UsersControllerTest extends TestCase {
$this->api
->expects($this->once())
->method('fillStorageInfo')
- ->with('UID')
+ ->with($targetUser)
->willReturn(['DummyValue']);
$backend = $this->createMock(UserInterface::class);
@@ -1441,7 +1446,7 @@ class UsersControllerTest extends TestCase {
$this->api
->expects($this->once())
->method('fillStorageInfo')
- ->with('UID')
+ ->with($targetUser)
->willReturn(['DummyValue']);
$backend = $this->createMock(UserInterface::class);
@@ -3806,6 +3811,7 @@ class UsersControllerTest extends TestCase {
$this->accountManager,
$this->subAdminManager,
$this->l10nFactory,
+ $this->rootFolder,
$this->urlGenerator,
$this->logger,
$this->newUserMailHelper,
@@ -3896,6 +3902,7 @@ class UsersControllerTest extends TestCase {
$this->accountManager,
$this->subAdminManager,
$this->l10nFactory,
+ $this->rootFolder,
$this->urlGenerator,
$this->logger,
$this->newUserMailHelper,