33 $email =
'sample@example.com', $groups = []
38 $this->password =
'TestUser';
40 $this->user = User::newFromName( $this->username );
47 if ( !$this->user->isLoggedIn() ) {
49 $this->user = User::createNew(
52 "real_name" => $realname
63 $change = $this->
setEmail( $email ) ||
67 $currentGroups = $this->user->getGroups();
68 foreach ( array_diff( $groups, $currentGroups ) as $group ) {
69 $this->user->addGroup( $group );
71 foreach ( array_diff( $currentGroups, $groups ) as $group ) {
72 $this->user->removeGroup( $group );
80 $this->user->mTouched =
'';
81 $this->user->saveSettings();