Skip to content

Commit 4fb561f

Browse files
committed
fix: profile picker tests
Signed-off-by: Julien Veyssier <[email protected]>
1 parent 69b73de commit 4fb561f

File tree

1 file changed

+16
-3
lines changed

1 file changed

+16
-3
lines changed

tests/unit/Reference/ProfilePickerReferenceProviderTest.php

+16-3
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,10 @@ class ProfilePickerReferenceProviderTest extends TestCase {
6868
'scope' => IAccountManager::SCOPE_LOCAL,
6969
'value' => 'Non-existing user',
7070
],
71+
IAccountManager::PROPERTY_PROFILE_ENABLED => [
72+
'scope' => IAccountManager::SCOPE_LOCAL,
73+
'value' => '1',
74+
],
7175
],
7276
'user2' => [
7377
IAccountManager::PROPERTY_BIOGRAPHY => [
@@ -94,6 +98,10 @@ class ProfilePickerReferenceProviderTest extends TestCase {
9498
'scope' => IAccountManager::SCOPE_LOCAL,
9599
'value' => 'Non-existing user',
96100
],
101+
IAccountManager::PROPERTY_PROFILE_ENABLED => [
102+
'scope' => IAccountManager::SCOPE_LOCAL,
103+
'value' => '1',
104+
],
97105
],
98106
'user3' => null,
99107
];
@@ -166,10 +174,10 @@ private function setupUserAccountReferenceExpectation(string $userId): ?IReferen
166174
$propertyMock = $this->createMock(IAccountProperty::class);
167175
$propertyMock->expects($this->any())
168176
->method('getValue')
169-
->willReturn($this->testAccountsData[$userId][$property]['value']);
177+
->willReturn($this->testAccountsData[$userId][$property]['value'] ?? '');
170178
$propertyMock->expects($this->any())
171179
->method('getScope')
172-
->willReturn($this->testAccountsData[$userId][$property]['scope']);
180+
->willReturn($this->testAccountsData[$userId][$property]['scope'] ?? '');
173181
return $propertyMock;
174182
});
175183

@@ -194,7 +202,12 @@ private function setupUserAccountReferenceExpectation(string $userId): ?IReferen
194202
'title' => $this->testUsersData[$userId]['displayname'],
195203
'subline' => $this->testUsersData[$userId]['email'] ?? $this->testUsersData[$userId]['displayname'],
196204
'email' => $this->testUsersData[$userId]['email'],
197-
'bio' => $bio !== null ? substr_replace($bio, '...', 80, strlen($bio)) : null,
205+
'bio' => isset($bio) && $bio !== ''
206+
? (mb_strlen($bio) > 80
207+
? (mb_substr($bio, 0, 80) . '...')
208+
: $bio)
209+
: null,
210+
'full_bio' => $bio,
198211
'headline' => $this->getTestAccountPropertyValue($userId, IAccountManager::PROPERTY_HEADLINE),
199212
'location' => $location,
200213
'location_url' => $location !== null ? 'https://www.openstreetmap.org/search?query=' . urlencode($location) : null,

0 commit comments

Comments
 (0)