From: YuviPanda Date: Thu, 20 Feb 2014 15:06:59 +0000 (+0530) Subject: Make ApiCreateAccount return camelcase statuses X-Git-Tag: 1.31.0-rc.0~16862 X-Git-Url: http://git.cyclocoop.org/%28%5B%5E/404?a=commitdiff_plain;h=efcf0a3f61b5bcdf5f9f6f716fa732b6afb9336e;p=lhc%2Fweb%2Fwiklou.git Make ApiCreateAccount return camelcase statuses Bug: 61663 Change-Id: I214d8eb7c9d49f55f49c5228c92806601c5499f6 --- diff --git a/includes/api/ApiCreateAccount.php b/includes/api/ApiCreateAccount.php index 7727b282c0..be8286c0bf 100644 --- a/includes/api/ApiCreateAccount.php +++ b/includes/api/ApiCreateAccount.php @@ -138,13 +138,13 @@ class ApiCreateAccount extends ApiBase { // since not having the correct token is part of the normal // flow of events. $result['token'] = LoginForm::getCreateaccountToken(); - $result['result'] = 'needtoken'; + $result['result'] = 'NeedToken'; } elseif ( !$status->isOK() ) { // There was an error. Die now. $this->dieStatus( $status ); } elseif ( !$status->isGood() ) { // Status is not good, but OK. This means warnings. - $result['result'] = 'warning'; + $result['result'] = 'Warning'; // Add any warnings to the result $warnings = $status->getErrorsByType( 'warning' ); @@ -157,7 +157,7 @@ class ApiCreateAccount extends ApiBase { } } else { // Everything was fine. - $result['result'] = 'success'; + $result['result'] = 'Success'; } // Give extensions a chance to modify the API result data @@ -229,9 +229,9 @@ class ApiCreateAccount extends ApiBase { 'createaccount' => array( 'result' => array( ApiBase::PROP_TYPE => array( - 'success', - 'warning', - 'needtoken' + 'Success', + 'Warning', + 'NeedToken' ) ), 'username' => array( diff --git a/tests/phpunit/includes/api/ApiCreateAccountTest.php b/tests/phpunit/includes/api/ApiCreateAccountTest.php index a7232457b6..8d134f7635 100644 --- a/tests/phpunit/includes/api/ApiCreateAccountTest.php +++ b/tests/phpunit/includes/api/ApiCreateAccountTest.php @@ -45,7 +45,7 @@ class ApiCreateAccountTest extends ApiTestCase { // Should first ask for token. $a = $result['createaccount']; - $this->assertEquals( 'needtoken', $a['result'] ); + $this->assertEquals( 'NeedToken', $a['result'] ); $token = $a['token']; // Finally create the account @@ -63,7 +63,7 @@ class ApiCreateAccountTest extends ApiTestCase { $result = $ret[0]; $this->assertNotInternalType( 'bool', $result ); - $this->assertEquals( 'success', $result['createaccount']['result'] ); + $this->assertEquals( 'Success', $result['createaccount']['result'] ); // Try logging in with the new user. $ret = $this->doApiRequest( array(