From 4fb561f307a8e3c11d954ebb188a3a5386fcf191 Mon Sep 17 00:00:00 2001 From: Julien Veyssier Date: Wed, 4 Dec 2024 15:02:48 +0100 Subject: [PATCH] fix: profile picker tests Signed-off-by: Julien Veyssier --- .../ProfilePickerReferenceProviderTest.php | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/tests/unit/Reference/ProfilePickerReferenceProviderTest.php b/tests/unit/Reference/ProfilePickerReferenceProviderTest.php index 47bb5c0b7..13a0bfcae 100644 --- a/tests/unit/Reference/ProfilePickerReferenceProviderTest.php +++ b/tests/unit/Reference/ProfilePickerReferenceProviderTest.php @@ -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 => [ @@ -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, ]; @@ -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; }); @@ -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,