"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "tests/phpunit/includes/cache/GenderCacheTest.php" between
mediawiki-1.31.1.tar.gz and mediawiki-1.32.0.tar.gz

About: MediaWiki is a wiki engine (the collaborative editing software that runs for e.g. Wikipedia, the free encyclopedia).

GenderCacheTest.php  (mediawiki-1.31.1):GenderCacheTest.php  (mediawiki-1.32.0)
skipping to change at line 44 skipping to change at line 44
} }
/** /**
* test usernames * test usernames
* *
* @dataProvider provideUserGenders * @dataProvider provideUserGenders
* @covers GenderCache::getGenderOf * @covers GenderCache::getGenderOf
*/ */
public function testUserName( $userKey, $expectedGender ) { public function testUserName( $userKey, $expectedGender ) {
$genderCache = MediaWikiServices::getInstance()->getGenderCache() ; $genderCache = MediaWikiServices::getInstance()->getGenderCache() ;
$username = isset( self::$nameMap[$userKey] ) ? self::$nameMap[$u serKey] : $userKey; $username = self::$nameMap[$userKey] ?? $userKey;
$gender = $genderCache->getGenderOf( $username ); $gender = $genderCache->getGenderOf( $username );
$this->assertEquals( $gender, $expectedGender, "GenderCache norma l" ); $this->assertEquals( $gender, $expectedGender, "GenderCache norma l" );
} }
/** /**
* genderCache should work with user objects, too * genderCache should work with user objects, too
* *
* @dataProvider provideUserGenders * @dataProvider provideUserGenders
* @covers GenderCache::getGenderOf * @covers GenderCache::getGenderOf
*/ */
public function testUserObjects( $userKey, $expectedGender ) { public function testUserObjects( $userKey, $expectedGender ) {
$username = isset( self::$nameMap[$userKey] ) ? self::$nameMap[$u serKey] : $userKey; $username = self::$nameMap[$userKey] ?? $userKey;
$genderCache = MediaWikiServices::getInstance()->getGenderCache() ; $genderCache = MediaWikiServices::getInstance()->getGenderCache() ;
$gender = $genderCache->getGenderOf( $username ); $gender = $genderCache->getGenderOf( $username );
$this->assertEquals( $gender, $expectedGender, "GenderCache norma l" ); $this->assertEquals( $gender, $expectedGender, "GenderCache norma l" );
} }
public static function provideUserGenders() { public static function provideUserGenders() {
return [ return [
[ 'UTMale', 'male' ], [ 'UTMale', 'male' ],
[ 'UTFemale', 'female' ], [ 'UTFemale', 'female' ],
[ 'UTDefaultGender', 'unknown' ], [ 'UTDefaultGender', 'unknown' ],
skipping to change at line 82 skipping to change at line 82
} }
/** /**
* test strip of subpages to avoid unnecessary queries * test strip of subpages to avoid unnecessary queries
* against the never existing username * against the never existing username
* *
* @dataProvider provideUserGenders * @dataProvider provideUserGenders
* @covers GenderCache::getGenderOf * @covers GenderCache::getGenderOf
*/ */
public function testStripSubpages( $userKey, $expectedGender ) { public function testStripSubpages( $userKey, $expectedGender ) {
$username = isset( self::$nameMap[$userKey] ) ? self::$nameMap[$u serKey] : $userKey; $username = self::$nameMap[$userKey] ?? $userKey;
$genderCache = MediaWikiServices::getInstance()->getGenderCache() ; $genderCache = MediaWikiServices::getInstance()->getGenderCache() ;
$gender = $genderCache->getGenderOf( "$username/subpage" ); $gender = $genderCache->getGenderOf( "$username/subpage" );
$this->assertEquals( $gender, $expectedGender, "GenderCache must strip of subpages" ); $this->assertEquals( $gender, $expectedGender, "GenderCache must strip of subpages" );
} }
} }
 End of changes. 3 change blocks. 
3 lines changed or deleted 3 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)