summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorFerdinand Thiessen <opensource@fthiessen.de>2025-02-23 19:24:04 +0100
committerbackportbot[bot] <backportbot[bot]@users.noreply.github.com>2025-02-24 15:23:20 +0000
commit29e5e8a31b93f726c1bcfc9a2d5ee14810377dfe (patch)
tree332087ec0b1ad3aa71b4207d10be391ee7bbd4d8 /tests
parente9c4c599987aa0b0e3bb9fa599be2a7075be74ac (diff)
downloadnextcloud-server-29e5e8a31b93f726c1bcfc9a2d5ee14810377dfe.tar.gz
nextcloud-server-29e5e8a31b93f726c1bcfc9a2d5ee14810377dfe.zip
fix: Optimize repair step performance
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
Diffstat (limited to 'tests')
-rw-r--r--tests/lib/Repair/NC29/ValidateAccountPropertiesTest.php27
1 files changed, 26 insertions, 1 deletions
diff --git a/tests/lib/Repair/NC29/ValidateAccountPropertiesTest.php b/tests/lib/Repair/NC29/ValidateAccountPropertiesTest.php
index cc43a63ca19..e113f180998 100644
--- a/tests/lib/Repair/NC29/ValidateAccountPropertiesTest.php
+++ b/tests/lib/Repair/NC29/ValidateAccountPropertiesTest.php
@@ -43,6 +43,7 @@ class ValidateAccountPropertiesTest extends TestCase {
$users = [
$this->createMock(IUser::class),
$this->createMock(IUser::class),
+ $this->createMock(IUser::class),
];
$this->userManager
->expects(self::once())
@@ -61,15 +62,39 @@ class ValidateAccountPropertiesTest extends TestCase {
$account1->expects(self::once())
->method('setProperty')
->with(IAccountManager::PROPERTY_PHONE, '', IAccountManager::SCOPE_LOCAL, IAccountManager::NOT_VERIFIED);
+ $account1->expects(self::once())
+ ->method('jsonSerialize')
+ ->willReturn([
+ IAccountManager::PROPERTY_DISPLAYNAME => [],
+ IAccountManager::PROPERTY_PHONE => [],
+ ]);
+
$account2 = $this->createMock(IAccount::class);
$account2->expects(self::never())
->method('getProperty');
+ $account2->expects(self::once())
+ ->method('jsonSerialize')
+ ->willReturn([
+ IAccountManager::PROPERTY_DISPLAYNAME => [],
+ IAccountManager::PROPERTY_PHONE => [],
+ ]);
+
+ $account3 = $this->createMock(IAccount::class);
+ $account3->expects(self::never())
+ ->method('getProperty');
+ $account3->expects(self::once())
+ ->method('jsonSerialize')
+ ->willReturn([
+ IAccountManager::PROPERTY_DISPLAYNAME => [],
+ ]);
+
$this->accountManager
- ->expects(self::exactly(2))
+ ->expects(self::exactly(3))
->method('getAccount')
->willReturnMap([
[$users[0], $account1],
[$users[1], $account2],
+ [$users[2], $account3],
]);
$valid = false;
$this->accountManager->expects(self::exactly(3))