2323use OCP \App \IAppManager ;
2424use OCP \AppFramework \Http \DataResponse ;
2525use OCP \AppFramework \OCS \OCSException ;
26+ use OCP \Config \IUserConfig ;
2627use OCP \EventDispatcher \IEventDispatcher ;
2728use OCP \Files \IRootFolder ;
2829use OCP \Group \ISubAdmin ;
@@ -66,6 +67,7 @@ class UsersControllerTest extends TestCase {
6667 private IRootFolder $ rootFolder ;
6768 private IPhoneNumberUtil $ phoneNumberUtil ;
6869 private IAppManager $ appManager ;
70+ private IUserConfig $ userConfig ;
6971
7072 protected function setUp (): void {
7173 parent ::setUp ();
@@ -88,6 +90,7 @@ protected function setUp(): void {
8890 $ this ->phoneNumberUtil = new PhoneNumberUtil ();
8991 $ this ->appManager = $ this ->createMock (IAppManager::class);
9092 $ this ->rootFolder = $ this ->createMock (IRootFolder::class);
93+ $ this ->userConfig = $ this ->createMock (IUserConfig::class);
9194
9295 $ l10n = $ this ->createMock (IL10N ::class);
9396 $ l10n ->method ('t ' )->willReturnCallback (fn (string $ txt , array $ replacement = []) => sprintf ($ txt , ...$ replacement ));
@@ -114,6 +117,7 @@ protected function setUp(): void {
114117 $ this ->eventDispatcher ,
115118 $ this ->phoneNumberUtil ,
116119 $ this ->appManager ,
120+ $ this ->userConfig ,
117121 ])
118122 ->onlyMethods (['fillStorageInfo ' ])
119123 ->getMock ();
@@ -506,6 +510,7 @@ public function testAddUserSuccessfulWithDisplayName(): void {
506510 $ this ->eventDispatcher ,
507511 $ this ->phoneNumberUtil ,
508512 $ this ->appManager ,
513+ $ this ->userConfig ,
509514 ])
510515 ->onlyMethods (['editUser ' ])
511516 ->getMock ();
@@ -2291,8 +2296,8 @@ public function testEditUserSelfEditChangeLanguage(): void {
22912296 ->method ('getUID ' )
22922297 ->willReturn ('UserToEdit ' );
22932298 $ targetUser = $ this ->createMock (IUser::class);
2294- $ this ->config ->expects ($ this ->once ())
2295- ->method ('setUserValue ' )
2299+ $ this ->userConfig ->expects ($ this ->once ())
2300+ ->method ('setValueString ' )
22962301 ->with ('UserToEdit ' , 'core ' , 'lang ' , 'de ' );
22972302 $ this ->userSession
22982303 ->expects ($ this ->once ())
@@ -2346,8 +2351,8 @@ public function testEditUserSelfEditChangeLanguageButForced($forced): void {
23462351 ->method ('getUID ' )
23472352 ->willReturn ('UserToEdit ' );
23482353 $ targetUser = $ this ->createMock (IUser::class);
2349- $ this ->config ->expects ($ this ->never ())
2350- ->method ('setUserValue ' );
2354+ $ this ->userConfig ->expects ($ this ->never ())
2355+ ->method ('setValueString ' );
23512356 $ this ->userSession
23522357 ->expects ($ this ->once ())
23532358 ->method ('getUser ' )
@@ -2387,8 +2392,8 @@ public function testEditUserAdminEditChangeLanguage(): void {
23872392 ->method ('getUID ' )
23882393 ->willReturn ('admin ' );
23892394 $ targetUser = $ this ->createMock (IUser::class);
2390- $ this ->config ->expects ($ this ->once ())
2391- ->method ('setUserValue ' )
2395+ $ this ->userConfig ->expects ($ this ->once ())
2396+ ->method ('setValueString ' )
23922397 ->with ('UserToEdit ' , 'core ' , 'lang ' , 'de ' );
23932398 $ this ->userSession
23942399 ->expects ($ this ->once ())
@@ -3850,6 +3855,7 @@ public function testGetCurrentUserLoggedIn(): void {
38503855 $ this ->eventDispatcher ,
38513856 $ this ->phoneNumberUtil ,
38523857 $ this ->appManager ,
3858+ $ this ->userConfig ,
38533859 ])
38543860 ->onlyMethods (['getUserData ' ])
38553861 ->getMock ();
@@ -3944,6 +3950,7 @@ public function testGetUser(): void {
39443950 $ this ->eventDispatcher ,
39453951 $ this ->phoneNumberUtil ,
39463952 $ this ->appManager ,
3953+ $ this ->userConfig ,
39473954 ])
39483955 ->onlyMethods (['getUserData ' ])
39493956 ->getMock ();
0 commit comments