jenkins-bot has submitted this change and it was merged.

Change subject: Use ApiTestCase Login instead of our own
......................................................................


Use ApiTestCase Login instead of our own

Change-Id: I435f0762e2c4ffa27df7338bfd92b33ecee462d8
REQUIRES : I6f79416e4580ed8b IN CORE <<<<<<-------
Seems silly to do soemthing agin here core already
nearly does for us..
More tidying up will come in further changes
---
M repo/tests/phpunit/includes/api/ModifyEntityTestBase.php
1 file changed, 2 insertions(+), 36 deletions(-)

Approvals:
  Tobias Gritschacher: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/repo/tests/phpunit/includes/api/ModifyEntityTestBase.php 
b/repo/tests/phpunit/includes/api/ModifyEntityTestBase.php
index e931f03..0e20f8c 100644
--- a/repo/tests/phpunit/includes/api/ModifyEntityTestBase.php
+++ b/repo/tests/phpunit/includes/api/ModifyEntityTestBase.php
@@ -267,42 +267,8 @@
         * Performs a login, if necessary, and returns the resulting session.
         */
        function login( $user = 'wbeditor' ) {
-               if ( !$this->isSetUp() ) {
-                       throw new \MWException( "can't log in before setUp() 
was run." );
-               }
-
-               if ( is_string( $user ) ) {
-                       $user = self::$users['wbeditor'];
-               }
-
-               if ( self::$loginSession && $user->username == 
self::$loginUser->username ) {
-                       return self::$loginSession;
-               }
-
-               // we are becoming someone else, need fresh tokens.
-               \ApiQueryInfo::resetTokenCache();
-
-               list($res,,) = $this->doApiRequest( array(
-                       'action' => 'login',
-                       'lgname' => $user->username,
-                       'lgpassword' => $user->password
-               ) );
-
-               $token = $res['login']['token'];
-
-               list(,,$session) = $this->doApiRequest(
-                       array(
-                               'action' => 'login',
-                               'lgtoken' => $token,
-                               'lgname' => $user->username,
-                               'lgpassword' => $user->password
-                       ),
-                       null
-               );
-
-               self::$token = null;
-               self::$loginUser = $user;
-               self::$loginSession = $session;
+               self::doLogin( $user );
+               self::$loginUser = self::$users[ $user ];
                return self::$loginSession;
        }
 

-- 
To view, visit https://gerrit.wikimedia.org/r/77885
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I435f0762e2c4ffa27df7338bfd92b33ecee462d8
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/Wikibase
Gerrit-Branch: master
Gerrit-Owner: Addshore <[email protected]>
Gerrit-Reviewer: Daniel Kinzler <[email protected]>
Gerrit-Reviewer: Tobias Gritschacher <[email protected]>
Gerrit-Reviewer: jenkins-bot

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to