mirror of
https://github.com/nextcloud/server.git
synced 2026-02-26 11:31:13 -05:00
feat(profile-picker): adjust tests
Signed-off-by: Julien Veyssier <julien-nc@posteo.net>
This commit is contained in:
parent
2fc9eda850
commit
ee44591509
1 changed files with 17 additions and 9 deletions
|
|
@ -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 {
|
||||
|
|
|
|||
Loading…
Reference in a new issue