r76483 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r76482‎ | r76483 | r76484 >
Date:22:52, 10 November 2010
Author:platonides
Status:deferred
Tags:
Comment:
Test for bug 25870.
Note that the Låura Fiorucci already passes, so the account creation http://en.wikipedia.org/w/index.php?title=Special%3ALog&page=User%3ALåura+Fiorucci should have been blocked.
Modified paths:
  • /trunk/extensions/AntiSpoof/TestSpoof.php (added) (history)

Diff [purge]

Index: trunk/extensions/AntiSpoof/TestSpoof.php
@@ -0,0 +1,44 @@
 2+<?php
 3+
 4+$IP = getenv( 'MW_INSTALL_PATH' );
 5+if ( !$IP ) {
 6+ if ( file_exists( "../../includes/DefaultSettings.php" ) ) {
 7+ $IP = '../..';
 8+ } elseif ( file_exists( "../../phase3/includes/DefaultSettings.php" ) ) {
 9+ $IP = '../../phase3';
 10+ } else {
 11+ die( 'Please set MW_INSTALL_PATH' );
 12+ }
 13+}
 14+
 15+require_once( "$IP/includes/AutoLoader.php" );
 16+require_once( "$IP/includes/normal/UtfNormalUtil.php" );
 17+require_once( dirname( __FILE__ ) . '/SpoofUser.php' );
 18+require_once( dirname( __FILE__ ) . '/AntiSpoof_body.php' );
 19+
 20+class TestSpoof extends PHPUnit_Framework_TestCase {
 21+
 22+ public function providePositives() {
 23+ return array(
 24+ array( 'Laura Fiorucci', 'Låura Fiorucci' ),
 25+ array( 'Lucien leGrey', 'Lucien le6rey' ),
 26+ array( 'Poco a poco', 'Poco a ƿoco' ),
 27+ array( 'Comae', 'Comæ' ),
 28+ array( 'Sabbut', 'ЅаЬЬцт'),
 29+ array( 'BetoCG', 'ВетоС6' )
 30+ );
 31+ }
 32+
 33+ /**
 34+ * @dataProvider providePositives
 35+ * See http://www.phpunit.de/manual/3.4/en/appendixes.annotations.html#appendixes.annotations.dataProvider
 36+ */
 37+ public function testCheckSpoofing( $userName, $spooferName ) {
 38+ $Alice = new SpoofUser( $userName );
 39+ $Eve = new SpoofUser( $spooferName );
 40+
 41+ if ( $Eve->isLegal() ) {
 42+ $this->assertEquals( $Alice->getNormalized(), $Eve->getNormalized(), "Check that '$spooferName' can't spoof account '$userName'");
 43+ }
 44+ }
 45+}
Property changes on: trunk/extensions/AntiSpoof/TestSpoof.php
___________________________________________________________________
Added: svn:eol-style
146 + native

Status & tagging log