Skip to content

Commit

Permalink
fix: profile picker tests
Browse files Browse the repository at this point in the history
Signed-off-by: Julien Veyssier <[email protected]>
  • Loading branch information
julien-nc committed Dec 4, 2024
1 parent 69b73de commit 4fb561f
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions tests/unit/Reference/ProfilePickerReferenceProviderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,10 @@ class ProfilePickerReferenceProviderTest extends TestCase {
'scope' => IAccountManager::SCOPE_LOCAL,
'value' => 'Non-existing user',
],
IAccountManager::PROPERTY_PROFILE_ENABLED => [
'scope' => IAccountManager::SCOPE_LOCAL,
'value' => '1',
],
],
'user2' => [
IAccountManager::PROPERTY_BIOGRAPHY => [
Expand All @@ -94,6 +98,10 @@ class ProfilePickerReferenceProviderTest extends TestCase {
'scope' => IAccountManager::SCOPE_LOCAL,
'value' => 'Non-existing user',
],
IAccountManager::PROPERTY_PROFILE_ENABLED => [
'scope' => IAccountManager::SCOPE_LOCAL,
'value' => '1',
],
],
'user3' => null,
];
Expand Down Expand Up @@ -166,10 +174,10 @@ private function setupUserAccountReferenceExpectation(string $userId): ?IReferen
$propertyMock = $this->createMock(IAccountProperty::class);
$propertyMock->expects($this->any())
->method('getValue')
->willReturn($this->testAccountsData[$userId][$property]['value']);
->willReturn($this->testAccountsData[$userId][$property]['value'] ?? '');
$propertyMock->expects($this->any())
->method('getScope')
->willReturn($this->testAccountsData[$userId][$property]['scope']);
->willReturn($this->testAccountsData[$userId][$property]['scope'] ?? '');
return $propertyMock;
});

Expand All @@ -194,7 +202,12 @@ private function setupUserAccountReferenceExpectation(string $userId): ?IReferen
'title' => $this->testUsersData[$userId]['displayname'],
'subline' => $this->testUsersData[$userId]['email'] ?? $this->testUsersData[$userId]['displayname'],
'email' => $this->testUsersData[$userId]['email'],
'bio' => $bio !== null ? substr_replace($bio, '...', 80, strlen($bio)) : null,
'bio' => isset($bio) && $bio !== ''
? (mb_strlen($bio) > 80
? (mb_substr($bio, 0, 80) . '...')
: $bio)
: null,
'full_bio' => $bio,
'headline' => $this->getTestAccountPropertyValue($userId, IAccountManager::PROPERTY_HEADLINE),
'location' => $location,
'location_url' => $location !== null ? 'https://www.openstreetmap.org/search?query=' . urlencode($location) : null,
Expand Down

0 comments on commit 4fb561f

Please sign in to comment.