diff options
Diffstat (limited to 'AntiSpoof/tests/phpunit/AntiSpoofTest.php')
-rw-r--r-- | AntiSpoof/tests/phpunit/AntiSpoofTest.php | 33 |
1 files changed, 31 insertions, 2 deletions
diff --git a/AntiSpoof/tests/phpunit/AntiSpoofTest.php b/AntiSpoof/tests/phpunit/AntiSpoofTest.php index d65df3ba..9a5edb99 100644 --- a/AntiSpoof/tests/phpunit/AntiSpoofTest.php +++ b/AntiSpoof/tests/phpunit/AntiSpoofTest.php @@ -1,4 +1,9 @@ <?php + +/** + * @covers AntiSpoof + * @group AntiSpoof + */ class AntiSpoofTest extends MediaWikiTestCase { public function providePositives() { @@ -10,14 +15,16 @@ class AntiSpoofTest extends MediaWikiTestCase { [ 'Sabbut', 'ЅаЬЬцт' ], [ 'BetoCG', 'ВетоС6' ], [ 'Wanda', 'vv4ndá' ], - [ 'Mario', 'rnAr10' ] + [ 'Mario', 'rnAr10' ], + [ 'CEASAR', 'ceasar' ], + [ 'ceasar', 'CEASAR' ], + [ 'jimmy wales', 'j1mmy w4l35' ] ]; } /** * Some very basic normalization checks * - * @covers AntiSpoof::checkUnicodeString * @dataProvider providePositives */ public function testCheckUnicodeString( $userName, $spooferName ) { @@ -29,4 +36,26 @@ class AntiSpoofTest extends MediaWikiTestCase { $this->assertEquals( $a[1], $b[1] ); } + + public function provideMixedCharSets() { + return [ + /** Format: username -> spoofing attempt */ + [ 'Recursive O Tester', 'Recursive Θ Tester' ], + [ 'Recursive 0 Tester', 'Recursive Θ Tester' ], + ]; + } + + /** + * Test mixed character set strings failure. + * + * @dataProvider provideMixedCharSets + */ + public function testCheckStringMixedCharSetFailure( $userName, $spooferName ) { + $a = AntiSpoof::checkUnicodeString( $userName ); + $b = AntiSpoof::checkUnicodeString( $spooferName ); + + $this->assertEquals( 'OK', $a[0] ); + $this->assertEquals( 'ERROR', $b[0] ); + $this->assertEquals( 'Contains incompatible mixed scripts', $b[1] ); + } } |