1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
<?php
class AntiSpoofTest extends MediaWikiTestCase {
public function providePositives() {
return [
/** Format: username -> spoofing attempt */
[ 'Laura Fiorucci', 'Låura Fiorucci' ],
[ 'Lucien leGrey', 'Lucien le6rey' ],
[ 'Poco a poco', 'Poco a ƿoco' ],
[ 'Sabbut', 'ЅаЬЬцт' ],
[ 'BetoCG', 'ВетоС6' ],
[ 'Wanda', 'vv4ndá' ],
[ 'Mario', 'rnAr10' ]
];
}
/**
* Some very basic normalization checks
*
* @covers AntiSpoof::checkUnicodeString
* @dataProvider providePositives
*/
public function testCheckUnicodeString( $userName, $spooferName ) {
$a = AntiSpoof::checkUnicodeString( $userName );
$b = AntiSpoof::checkUnicodeString( $spooferName );
$this->assertEquals( 'OK', $a[0] );
$this->assertEquals( 'OK', $b[0] );
$this->assertEquals( $a[1], $b[1] );
}
}
|