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

Change subject: Limit when we log in for Api Tests
......................................................................


Limit when we log in for Api Tests

This cuts 50% of the run time from Api tests for me
The last time I tried this change Travis complained
Now that the test base has been refactored and
Item ids are no longer really important this
should work!
Change-Id: Ib528385c31524390af458e5c02a000839d7795a2
---
M repo/tests/phpunit/includes/api/WikibaseApiTestCase.php
1 file changed, 8 insertions(+), 15 deletions(-)

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



diff --git a/repo/tests/phpunit/includes/api/WikibaseApiTestCase.php 
b/repo/tests/phpunit/includes/api/WikibaseApiTestCase.php
index 76bf209..88605a9 100644
--- a/repo/tests/phpunit/includes/api/WikibaseApiTestCase.php
+++ b/repo/tests/phpunit/includes/api/WikibaseApiTestCase.php
@@ -53,22 +53,11 @@
        protected static $loginUser = null;
        protected static $token = null;
 
-       protected $setUpComplete = false;
-
-       protected function isSetUp() {
-               return $this->setUpComplete;
-       }
-
        public function setUp() {
                global $wgUser;
                parent::setUp();
 
-               static $hasSites = false;
-
-               if ( !$hasSites ) {
-                       \TestSites::insertIntoDb();
-                       $hasSites = true;
-               }
+               static $isSetup = false;
 
                self::$usepost = Settings::get( 'apiInDebug' ) ? Settings::get( 
'apiDebugWithPost' ) : true;
                self::$usetoken = Settings::get( 'apiInDebug' ) ? 
Settings::get( 'apiDebugWithTokens' ) : true;
@@ -83,13 +72,17 @@
 
                $wgUser = self::$users['wbeditor']->user;
 
-               $this->login();
+               if ( !$isSetup ) {
+                       \TestSites::insertIntoDb();
+
+                       $this->login();
+
+                       $isSetup = true;
+               }
 
                //TODO: preserve session and token between calls?!
                self::$loginSession = false;
                self::$token = false;
-
-               $this->setUpComplete = true;
        }
 
        /**

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Ib528385c31524390af458e5c02a000839d7795a2
Gerrit-PatchSet: 3
Gerrit-Project: mediawiki/extensions/Wikibase
Gerrit-Branch: master
Gerrit-Owner: Addshore <[email protected]>
Gerrit-Reviewer: Aude <[email protected]>
Gerrit-Reviewer: Daniel Kinzler <[email protected]>
Gerrit-Reviewer: Daniel Werner <[email protected]>
Gerrit-Reviewer: Jeroen De Dauw <[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