MediaWiki REL1_30
UserWrapper.php
Go to the documentation of this file.
1<?php
2
4 public $userName;
5 public $password;
6 public $user;
7
8 public function __construct( $userName, $password, $group = '' ) {
9 $this->userName = $userName;
10 $this->password = $password;
11
12 $this->user = User::newFromName( $this->userName );
13 if ( !$this->user->getId() ) {
14 $this->user = User::createNew( $this->userName, [
15 "email" => "test@example.com",
16 "real_name" => "Test User" ] );
17 }
18 TestUser::setPasswordForUser( $this->user, $this->password );
19
20 if ( $group !== '' ) {
21 $this->user->addGroup( $group );
22 }
23 $this->user->saveSettings();
24 }
25}
static setPasswordForUser(User $user, $password)
Set the password on a testing user.
Definition TestUser.php:127
__construct( $userName, $password, $group='')