From 8cb078b58c4e657557436907b8b90eed6fff1153 Mon Sep 17 00:00:00 2001 From: Faraz Samapoor Date: Sun, 2 Jul 2023 12:01:11 +0330 Subject: Fixes testcase errors. Signed-off-by: Faraz Samapoor --- lib/private/Accounts/AccountManager.php | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'lib/private/Accounts') diff --git a/lib/private/Accounts/AccountManager.php b/lib/private/Accounts/AccountManager.php index 73492b63a26..3574d1a90a0 100644 --- a/lib/private/Accounts/AccountManager.php +++ b/lib/private/Accounts/AccountManager.php @@ -85,7 +85,7 @@ class AccountManager implements IAccountManager { private string $table = 'accounts'; private string $dataTable = 'accounts_data'; - private IL10N $l10n; + private ?IL10N $l10n = null; private CappedMemoryCache $internalCache; /** @@ -120,7 +120,6 @@ class AccountManager implements IAccountManager { private ICrypto $crypto, ) { $this->internalCache = new CappedMemoryCache(); - $this->l10n = $factory->get('core'); } /** @@ -348,12 +347,10 @@ class AccountManager implements IAccountManager { } protected function searchUsersForRelatedCollection(string $property, array $values): array { - switch ($property) { - case IAccountManager::PROPERTY_EMAIL: - return array_flip($this->searchUsers(IAccountManager::COLLECTION_EMAIL, $values)); - default: - return []; - } + return match ($property) { + IAccountManager::PROPERTY_EMAIL => array_flip($this->searchUsers(IAccountManager::COLLECTION_EMAIL, $values)), + default => [], + }; } /** @@ -416,6 +413,10 @@ class AccountManager implements IAccountManager { 'link' => $link, ]); + if (!$this->l10n) { + $this->l10n = $this->factory->get('core'); + } + $emailTemplate->setSubject($this->l10n->t('%s email verification', [$this->defaults->getName()])); $emailTemplate->addHeader(); $emailTemplate->addHeading($this->l10n->t('Email verification')); -- cgit v1.2.3