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

Change subject: Revert "TestBase now uses parent doLogin correctly"
......................................................................


Revert "TestBase now uses parent doLogin correctly"

This reverts commit 4623713c133975c6f259bc2734d27949ca07a60f.

Change-Id: I537cb50c2a2c34e824243d34b10534ccb27ef146
---
M repo/tests/phpunit/includes/api/BotEditTest.php
M repo/tests/phpunit/includes/api/ModifyEntityTestBase.php
2 files changed, 15 insertions(+), 5 deletions(-)

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



diff --git a/repo/tests/phpunit/includes/api/BotEditTest.php 
b/repo/tests/phpunit/includes/api/BotEditTest.php
index a5df48f..5d0108a 100644
--- a/repo/tests/phpunit/includes/api/BotEditTest.php
+++ b/repo/tests/phpunit/includes/api/BotEditTest.php
@@ -74,7 +74,7 @@
                        'wgUser' => self::$users['wbbot']->user,
                ) );
 
-               $this->doLogin( 'wbbot' );
+               $this->login( 'wbbot' );
        }
 
        /**
diff --git a/repo/tests/phpunit/includes/api/ModifyEntityTestBase.php 
b/repo/tests/phpunit/includes/api/ModifyEntityTestBase.php
index 5766946..3437004 100644
--- a/repo/tests/phpunit/includes/api/ModifyEntityTestBase.php
+++ b/repo/tests/phpunit/includes/api/ModifyEntityTestBase.php
@@ -57,6 +57,8 @@
        protected static $entityInput = null; // entities in input format, 
using handles as keys
        protected static $entityOutput = array(); // entities in output format, 
using handles as keys
 
+       protected static $loginUser = null;
+
        public function setUp() {
                parent::setUp();
 
@@ -77,7 +79,7 @@
                        'wgUser' => self::$users['wbeditor']->user,
                ) );
 
-               $this->doLogin();
+               $this->login();
 
                self::initEntities();
        }
@@ -245,12 +247,20 @@
                );
        }
 
-       function doLogin( $user = 'wbeditor' ) {
-               return parent::doLogin( $user );
+       /**
+        * Performs a login, if necessary, and returns the resulting session.
+        */
+       function login( $user = 'wbeditor' ) {
+               $data = self::doLogin( $user );
+               self::$loginUser = self::$users[ $user ];
+               return $data;
        }
 
+       /**
+        * Gets an entity edit token.
+        */
        function getToken( $type = 'edittoken' ) {
-               $tokens = self::getTokenList( null );
+               $tokens = self::getTokenList( self::$loginUser );
                return $tokens[$type];
        }
 

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I537cb50c2a2c34e824243d34b10534ccb27ef146
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Wikibase
Gerrit-Branch: master
Gerrit-Owner: Addshore <addshorew...@gmail.com>
Gerrit-Reviewer: Addshore <addshorew...@gmail.com>
Gerrit-Reviewer: jenkins-bot

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to