From efcf0a3f61b5bcdf5f9f6f716fa732b6afb9336e Mon Sep 17 00:00:00 2001 From: YuviPanda Date: Thu, 20 Feb 2014 20:36:59 +0530 Subject: [PATCH] Make ApiCreateAccount return camelcase statuses Bug: 61663 Change-Id: I214d8eb7c9d49f55f49c5228c92806601c5499f6 --- includes/api/ApiCreateAccount.php | 12 ++++++------ tests/phpunit/includes/api/ApiCreateAccountTest.php | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-) 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( -- 2.20.1