Fix testGetCanonicalName PHPUnit test:
authorMatthew Flaschen <mflaschen@wikimedia.org>
Fri, 27 Feb 2015 05:35:08 +0000 (00:35 -0500)
committerMattflaschen <mflaschen@wikimedia.org>
Fri, 27 Feb 2015 06:06:06 +0000 (06:06 +0000)
* assertEquals takes expected, prior to actual
  https://phpunit.de/manual/3.7/en/writing-tests-for-phpunit.html#writing-tests-for-phpunit.assertions.assertEquals
* ' trailing space ' test was failing with wgCapitalLinks false.  Since the test is not about that,
  I changed it to ' Trailing space '.  The alternative would be to force wgCapitalLinks to true
  with setMwGlobals or skip the test if it's true.

Change-Id: I677273045bdabb6248ffe2c2f003a3673b3fa51c

tests/phpunit/includes/UserTest.php

index c3cb193..860529e 100644 (file)
@@ -332,8 +332,8 @@ class UserTest extends MediaWikiTestCase {
        public function testGetCanonicalName( $name, $expectedArray, $msg ) {
                foreach ( $expectedArray as $validate => $expected ) {
                        $this->assertEquals(
-                               User::getCanonicalName( $name, $validate === 'false' ? false : $validate ),
                                $expected,
+                               User::getCanonicalName( $name, $validate === 'false' ? false : $validate ),
                                $msg . ' (' . $validate . ')'
                        );
                }
@@ -341,7 +341,7 @@ class UserTest extends MediaWikiTestCase {
 
        public static function provideGetCanonicalName() {
                return array(
-                       array( ' trailing space ', array( 'creatable' => 'Trailing space' ), 'Trailing spaces' ),
+                       array( ' Trailing space ', array( 'creatable' => 'Trailing space' ), 'Trailing spaces' ),
                        // @todo FIXME: Maybe the creatable name should be 'Talk:Username' or false to reject?
                        array( 'Talk:Username', array( 'creatable' => 'Username', 'usable' => 'Username',
                                'valid' => 'Username', 'false' => 'Talk:Username' ), 'Namespace prefix' ),