From 29e5e8a31b93f726c1bcfc9a2d5ee14810377dfe Mon Sep 17 00:00:00 2001 From: Ferdinand Thiessen Date: Sun, 23 Feb 2025 19:24:04 +0100 Subject: fix: Optimize repair step performance Signed-off-by: Ferdinand Thiessen --- .../Repair/NC29/ValidateAccountPropertiesTest.php | 27 +++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) (limited to 'tests') 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)) -- cgit v1.2.3