diff options
author | Christopher Ng <chrng8@gmail.com> | 2022-06-02 04:37:18 +0300 |
---|---|---|
committer | backportbot-nextcloud[bot] <backportbot-nextcloud[bot]@users.noreply.github.com> | 2022-06-09 02:31:25 +0300 |
commit | a64b1f77c2f690219fb3e33bc841c167afe0785b (patch) | |
tree | 7b47f9ff6ad9f0e866d48dbd76aa9fd53370d83e /tests/lib | |
parent | 1cf2ed484eeb101566ca1bc570b2b52a2936d7b5 (diff) |
Fix get avatar authorization
Signed-off-by: Christopher Ng <chrng8@gmail.com>
Diffstat (limited to 'tests/lib')
-rw-r--r-- | tests/lib/Avatar/AvatarManagerTest.php | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/lib/Avatar/AvatarManagerTest.php b/tests/lib/Avatar/AvatarManagerTest.php index ce6981a2a21..6dfc664abe1 100644 --- a/tests/lib/Avatar/AvatarManagerTest.php +++ b/tests/lib/Avatar/AvatarManagerTest.php @@ -161,6 +161,10 @@ class AvatarManagerTest extends \Test\TestCase { ->method('getUID') ->willReturn('valid-user'); + $this->userSession->expects($this->once()) + ->method('getUser') + ->willReturn($user); + $folder = $this->createMock(ISimpleFolder::class); $this->appData ->expects($this->once()) @@ -168,6 +172,22 @@ class AvatarManagerTest extends \Test\TestCase { ->with('valid-user') ->willReturn($folder); + $account = $this->createMock(IAccount::class); + $this->accountManager->expects($this->once()) + ->method('getAccount') + ->with($user) + ->willReturn($account); + + $property = $this->createMock(IAccountProperty::class); + $account->expects($this->once()) + ->method('getProperty') + ->with(IAccountManager::PROPERTY_AVATAR) + ->willReturn($property); + + $property->expects($this->once()) + ->method('getScope') + ->willReturn(IAccountManager::SCOPE_FEDERATED); + $expected = new UserAvatar($folder, $this->l10n, $user, $this->logger, $this->config); $this->assertEquals($expected, $this->avatarManager->getAvatar('vaLid-USER')); } |