@@ -155,6 +155,13 @@ public function testUpdateAttributes() {
155155 /** @var IUser|MockObject $user */
156156 $ user = $ this ->createMock (IUser::class);
157157
158+ $ attributes = [
159+ 160+ 'displayname ' => 'New Displayname ' ,
161+ 'quota ' => '50MB ' ,
162+ 'groups ' => ['groupB ' , 'groupC ' ],
163+ ];
164+
158165 // Replace at() matcher with willReturnCallback to avoid deprecation warning
159166 $ this ->config
160167 ->method ('getAppValue ' )
@@ -204,19 +211,20 @@ public function testUpdateAttributes() {
204211 ->expects ($ this ->once ())
205212 ->method ('handleIncomingGroups ' )
206213 ->with ($ user , ['groupB ' , 'groupC ' ]);
207- $ this ->userBackend ->updateAttributes ('ExistingUser ' , [
208- 209- 'displayname ' => 'New Displayname ' ,
210- 'quota ' => '50MB ' ,
211- 'groups ' => ['groupB ' , 'groupC ' ],
212- ]);
214+ $ this ->userData ->expects ($ this ->any ())
215+ ->method ('getAttributes ' )
216+ ->willReturn ($ attributes );
217+ $ this ->userData ->expects ($ this ->any ())
218+ ->method ('getGroups ' )
219+ ->willReturn ($ attributes ['groups ' ]);
220+ $ this ->userBackend ->updateAttributes ('ExistingUser ' );
213221 }
214222
215223 public function testUpdateAttributesQuotaDefaultFallback () {
216224 $ this ->getMockedBuilder (['getDisplayName ' , 'setDisplayName ' ]);
217225 /** @var IUser|MockObject $user */
218226 $ user = $ this ->createMock (IUser::class);
219-
227+ $ attributes = [ ' email ' => ' [email protected] ' , ' displayname ' => ' New Displayname ' , ' quota ' => '' ]; 220228
221229 $ this ->config ->method ('getAppValue ' )
222230 ->willReturnCallback (fn (string $ appId , string $ key , string $ default ) =>
@@ -261,6 +269,12 @@ public function testUpdateAttributesQuotaDefaultFallback() {
261269 ->expects ($ this ->once ())
262270 ->method ('handleIncomingGroups ' )
263271 ->with ($ user , []);
264- $ this ->
userBackend ->
updateAttributes (
'ExistingUser ' , [
'email ' =>
'[email protected] ' ,
'displayname ' =>
'New Displayname ' ,
'quota ' =>
'' ]);
272+ $ this ->userData ->expects ($ this ->any ())
273+ ->method ('getAttributes ' )
274+ ->willReturn ($ attributes );
275+ $ this ->userData ->expects ($ this ->any ())
276+ ->method ('getGroups ' )
277+ ->willReturn ([]);
278+ $ this ->userBackend ->updateAttributes ('ExistingUser ' );
265279 }
266280}
0 commit comments