@@ -459,6 +459,51 @@ public function testUpdateUser()
459459 $ this ->assertNotEquals ($ verify , $ verify_new );
460460 }
461461
462+ public function testAdministratorCanUpdateNewNonSsoUserMoreThanOnce (): void
463+ {
464+ $ response = $ this ->apiCall ('POST ' , self ::API_TEST_URL , [
465+ 'username ' => 'new-non-sso-user ' ,
466+ 'firstname ' => 'New ' ,
467+ 'lastname ' => 'User ' ,
468+ 'email ' => Faker::create ()->email (),
469+ 'status ' => 'ACTIVE ' ,
470+ 'password ' => $ this ->makePassword (),
471+ ]);
472+
473+ $ response ->assertStatus (201 );
474+ $ user = User::findOrFail ($ response ->json ('id ' ));
475+ $ this ->assertNull ($ user ->meta );
476+ $ url = self ::API_TEST_URL . '/ ' . $ user ->id ;
477+ $ metadata = ['customProfileProperty ' => null ];
478+
479+ $ response = $ this ->apiCall (
480+ 'PUT ' ,
481+ $ url ,
482+ $ this ->getSelfServiceUpdateData ($ user , ['meta ' => $ metadata ])
483+ );
484+
485+ $ response ->assertStatus (204 );
486+ $ user ->refresh ();
487+ $ this ->assertNotNull ($ user ->meta );
488+ $ this ->assertTrue (property_exists ($ user ->meta , 'customProfileProperty ' ));
489+ $ this ->assertFalse (property_exists ($ user ->meta , 'authenticationType ' ));
490+
491+ $ response = $ this ->apiCall (
492+ 'PUT ' ,
493+ $ url ,
494+ $ this ->getSelfServiceUpdateData ($ user , [
495+ 'title ' => 'Updated Twice ' ,
496+ 'meta ' => $ metadata ,
497+ ])
498+ );
499+
500+ $ response ->assertStatus (204 );
501+ $ this ->assertDatabaseHas ('users ' , [
502+ 'id ' => $ user ->id ,
503+ 'title ' => 'Updated Twice ' ,
504+ ]);
505+ }
506+
462507 /**
463508 * Update user in process
464509 */
0 commit comments