Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorVincent Petry <vincent@nextcloud.com>2021-03-25 14:21:03 +0300
committerVincent Petry <vincent@nextcloud.com>2021-03-26 15:07:09 +0300
commitbb008be28af2e7379883543d73c18f63680915a6 (patch)
tree86989d073d8eacc681d000cebc39ae968cc43586 /tests
parentb66af8a4329852ee599438c5be74e9246b4e0a68 (diff)
Added PlaceholderAvatar with own cached images
When avatar scope is private, the PlaceholderAvatar is used to deliver a placeholder avatar based on the user's initials. This was implemented as a separate class for now to avoid messing with the existing UserAvatar implementation and its generated vs non-generated logic. Signed-off-by: Vincent Petry <vincent@nextcloud.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/lib/Avatar/AvatarManagerTest.php11
1 files changed, 7 insertions, 4 deletions
diff --git a/tests/lib/Avatar/AvatarManagerTest.php b/tests/lib/Avatar/AvatarManagerTest.php
index 0ce0e752569..1b06e786fb1 100644
--- a/tests/lib/Avatar/AvatarManagerTest.php
+++ b/tests/lib/Avatar/AvatarManagerTest.php
@@ -25,7 +25,7 @@
namespace Test\Avatar;
use OC\Avatar\AvatarManager;
-use OC\Avatar\GuestAvatar;
+use OC\Avatar\PlaceholderAvatar;
use OC\Avatar\UserAvatar;
use OC\User\Manager;
use OCP\Accounts\IAccount;
@@ -159,10 +159,13 @@ class AvatarManagerTest extends \Test\TestCase {
->method('get')
->with('valid-user')
->willReturn($user);
+
$folder = $this->createMock(ISimpleFolder::class);
$this->appData
- ->expects($this->never())
- ->method('getFolder');
+ ->expects($this->once())
+ ->method('getFolder')
+ ->with('valid-user')
+ ->willReturn($folder);
$account = $this->createMock(IAccount::class);
$this->accountManager->expects($this->once())
@@ -180,7 +183,7 @@ class AvatarManagerTest extends \Test\TestCase {
->method('getScope')
->willReturn(IAccountManager::SCOPE_PRIVATE);
- $expected = new GuestAvatar('valid-user', $this->createMock(ILogger::class));
+ $expected = new PlaceholderAvatar($folder, $user, $this->createMock(ILogger::class));
$this->assertEquals($expected, $this->avatarManager->getAvatar('valid-user'));
}
}