18 $male->setOption(
'gender',
'male' );
19 $male->saveSettings();
22 $female->setOption(
'gender',
'female' );
23 $female->saveSettings();
26 $default->setOption(
'gender',
null );
27 $default->saveSettings();
30 'UTMale' => $male->getName(),
31 'UTFemale' => $female->getName(),
32 'UTDefaultGender' => $default->getName()
43 $genderCache = MediaWikiServices::getInstance()->getGenderCache();
44 $username = self::$nameMap[$userKey] ?? $userKey;
45 $gender = $genderCache->getGenderOf(
$username );
46 $this->assertEquals( $gender, $expectedGender,
"GenderCache normal" );
56 $username = self::$nameMap[$userKey] ?? $userKey;
57 $genderCache = MediaWikiServices::getInstance()->getGenderCache();
58 $gender = $genderCache->getGenderOf(
$username );
59 $this->assertEquals( $gender, $expectedGender,
"GenderCache normal" );
65 [
'UTFemale',
'female' ],
66 [
'UTDefaultGender',
'unknown' ],
67 [
'UTNotExist',
'unknown' ],
69 [
'127.0.0.1',
'unknown' ],
70 [
'user@test',
'unknown' ],
82 $username = self::$nameMap[$userKey] ?? $userKey;
83 $genderCache = MediaWikiServices::getInstance()->getGenderCache();
84 $gender = $genderCache->getGenderOf(
"$username/subpage" );
85 $this->assertEquals( $gender, $expectedGender,
"GenderCache must strip of subpages" );
testStripSubpages( $userKey, $expectedGender)
test strip of subpages to avoid unnecessary queries against the never existing username
static string[] $nameMap
User key => username.
static provideUserGenders()
testUserObjects( $userKey, $expectedGender)
genderCache should work with user objects, too
testUserName( $userKey, $expectedGender)
test usernames
this hook is for auditing only or null if authentication failed before getting that far $username