http://www.mediawiki.org/wiki/Special:Code/MediaWiki/99466
Revision: 99466
Author: santhosh
Date: 2011-10-11 09:17:36 +0000 (Tue, 11 Oct 2011)
Log Message:
-----------
Testcases for isValidUserName method of User.php.
There are many cases this method will fail for non-latin languages,
but not added now since there are bugs reported on that already and results
a rewrite of the method as per UAX 31 standard.
Modified Paths:
--------------
trunk/phase3/tests/phpunit/includes/UserTest.php
Modified: trunk/phase3/tests/phpunit/includes/UserTest.php
===================================================================
--- trunk/phase3/tests/phpunit/includes/UserTest.php 2011-10-11 09:16:14 UTC
(rev 99465)
+++ trunk/phase3/tests/phpunit/includes/UserTest.php 2011-10-11 09:17:36 UTC
(rev 99466)
@@ -164,4 +164,22 @@
),
);
}
+
+ public function testIsValidUserName() {
+ $this->assertFalse( $this->user->isValidUserName( '' ) );
+ $this->assertFalse( $this->user->isValidUserName( ' ' ) );
+ $this->assertFalse( $this->user->isValidUserName( 'abcd' ) );
+ $this->assertFalse( $this->user->isValidUserName( 'Ab/cd' ) );
+ $this->assertTrue( $this->user->isValidUserName( 'Ab cd' ) );
// Whitespace
+ $this->assertFalse( $this->user->isValidUserName( '192.168.1.1'
) ); // IP
+ $this->assertFalse( $this->user->isValidUserName( 'User:Abcd' )
); // Reserved Namespace
+ $this->assertTrue( $this->user->isValidUserName( '12abcd232' )
);
+ $this->assertTrue( $this->user->isValidUserName( '12abcd.232' )
);
+ $this->assertTrue( $this->user->isValidUserName( '?abcd' ) );
+ $this->assertFalse( $this->user->isValidUserName( '#abcd' ) );
+ $this->assertTrue( $this->user->isValidUserName( 'Abcdകഖഗഘ' )
); // Mixed scripts
+ $this->assertFalse( $this->user->isValidUserName( 'ജോസ്തോമസ്'
) ); // ZWNJ
+ $this->assertFalse( $this->user->isValidUserName( 'Ab cd' ) );
// Ideographic space
+ }
+
}
_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs