- Splits multiple classes into individual files - Adds @covers tags - Fixes scope Change-Id: I7d2816d3574fa53a2aaa8e2a84b7a7ecdd245252
25 lines
No EOL
580 B
PHP
25 lines
No EOL
580 B
PHP
<?php
|
|
|
|
class UserWrapper {
|
|
public $userName;
|
|
public $password;
|
|
public $user;
|
|
|
|
public function __construct( $userName, $password, $group = '' ) {
|
|
$this->userName = $userName;
|
|
$this->password = $password;
|
|
|
|
$this->user = User::newFromName( $this->userName );
|
|
if ( !$this->user->getID() ) {
|
|
$this->user = User::createNew( $this->userName, array(
|
|
"email" => "test@example.com",
|
|
"real_name" => "Test User" ) );
|
|
}
|
|
$this->user->setPassword( $this->password );
|
|
|
|
if ( $group !== '' ) {
|
|
$this->user->addGroup( $group );
|
|
}
|
|
$this->user->saveSettings();
|
|
}
|
|
} |