From ee44591509f962d93a0a778dd1f314d7a2e628fa Mon Sep 17 00:00:00 2001 From: Julien Veyssier Date: Mon, 23 Feb 2026 14:44:59 +0100 Subject: [PATCH] feat(profile-picker): adjust tests Signed-off-by: Julien Veyssier --- .../ProfilePickerReferenceProviderTest.php | 26 ++++++++++++------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/apps/profile/tests/Reference/ProfilePickerReferenceProviderTest.php b/apps/profile/tests/Reference/ProfilePickerReferenceProviderTest.php index 45aeb51f1c7..dd56dcf80db 100644 --- a/apps/profile/tests/Reference/ProfilePickerReferenceProviderTest.php +++ b/apps/profile/tests/Reference/ProfilePickerReferenceProviderTest.php @@ -14,6 +14,7 @@ use OCP\Accounts\IAccountManager; use OCP\Accounts\IAccountProperty; use OCP\Collaboration\Reference\IReference; use OCP\Collaboration\Reference\Reference; +use OCP\IAppConfig; use OCP\IL10N; use OCP\IURLGenerator; @@ -31,6 +32,7 @@ class ProfilePickerReferenceProviderTest extends \Test\TestCase { private IUserManager|MockObject $userManager; private IAccountManager|MockObject $accountManager; private IProfileManager|MockObject $profileManager; + private IAppConfig|MockObject $appConfig; private ProfilePickerReferenceProvider $referenceProvider; private array $testUsersData = [ @@ -141,15 +143,7 @@ class ProfilePickerReferenceProviderTest extends \Test\TestCase { $this->userManager = $this->createMock(IUserManager::class); $this->accountManager = $this->createMock(IAccountManager::class); $this->profileManager = $this->createMock(IProfileManager::class); - - $this->referenceProvider = new ProfilePickerReferenceProvider( - $this->l10n, - $this->urlGenerator, - $this->userManager, - $this->accountManager, - $this->profileManager, - $this->userId - ); + $this->appConfig = $this->createMock(IAppConfig::class); $this->urlGenerator->expects($this->any()) ->method('getBaseUrl') @@ -159,6 +153,10 @@ class ProfilePickerReferenceProviderTest extends \Test\TestCase { ->method('isProfileEnabled') ->willReturn(true); + $this->appConfig->expects($this->any()) + ->method('getValueString') + ->willReturn('1'); + $this->profileManager->expects($this->any()) ->method('isProfileFieldVisible') ->willReturnCallback(function (string $profileField, IUser $targetUser, ?IUser $visitingUser) { @@ -173,6 +171,16 @@ class ProfilePickerReferenceProviderTest extends \Test\TestCase { $this->adminUser->expects($this->any()) ->method('getDisplayName') ->willReturn('admin'); + + $this->referenceProvider = new ProfilePickerReferenceProvider( + $this->l10n, + $this->urlGenerator, + $this->userManager, + $this->accountManager, + $this->profileManager, + $this->appConfig, + $this->userId + ); } private function getTestAccountPropertyValue(string $testUserId, string $property): mixed {