18 if ( !self::$randInt ) {
19 self::$randInt = mt_rand( 1, 0xFFFFFF );
21 return sprintf(
'%06x.%03x', self::$randInt, ++self::$counter );
38 "TestUser $testName $id",
44 $testUser->getUser()->clearInstanceCache();
61 $groups = array_unique( $groups );
63 $key = implode(
',', $groups );
65 $testUser = isset( self::$testUsers[$key] )
66 ? self::$testUsers[$key]
69 if ( !$testUser || !$testUser->getUser()->isLoggedIn() ) {
75 if ( $groups === [
'bureaucrat',
'sysop' ] ) {
77 $password =
'UTSysopPassword';
82 self::$testUsers[$key] = $testUser =
new TestUser(
91 $testUser->getUser()->clearInstanceCache();
92 return self::$testUsers[$key];
108 self::$testUsers = [];
wfRandomString( $length=32)
Get a random string containing a number of pseudo-random hex characters.
static int $randInt
Random int, included in IDs.
static clear()
Clear the registry.
static getMutableTestUser( $testName, $groups=[])
Get a TestUser object that the caller may modify.
static getImmutableTestUser( $groups=[])
Get a TestUser object that the caller may not modify.
static TestUser[] $testUsers
(group key => TestUser)
static int $counter
Count of users that have been generated.
Wraps the user object, so we can also retain full access to properties like password if we log in via...
this hook is for auditing only or null if authentication failed before getting that far $username