Addshore has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/77887


Change subject: Use the new getEditToken format from ApiTestCase
......................................................................

Use the new getEditToken format from ApiTestCase

Change-Id: Iaa949bae696dad98756e6c99b910e22eb476b0bc
REQUIRES: Ibc2c678b82464fe3c3de3 IN CORE <<<----
---
M repo/tests/phpunit/includes/api/ModifyEntityTestBase.php
1 file changed, 4 insertions(+), 14 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase 
refs/changes/87/77887/1

diff --git a/repo/tests/phpunit/includes/api/ModifyEntityTestBase.php 
b/repo/tests/phpunit/includes/api/ModifyEntityTestBase.php
index b30a85d..78c83e4 100644
--- a/repo/tests/phpunit/includes/api/ModifyEntityTestBase.php
+++ b/repo/tests/phpunit/includes/api/ModifyEntityTestBase.php
@@ -273,18 +273,10 @@
        }
 
        /**
-        * Gets an entity edit token.
-        */
-       function getEditToken() {
-               $tokens = self::getTokenList( self::$loginUser );
-               return $tokens['edittoken'];
-       }
-
-       /**
         *  Appends an edit token to a request
         */
        function doApiRequestWithToken( array $params, array $session = null, 
User $user = null ) {
-               $params['token'] = $this->getEditToken();
+               $params['token'] = self::getToken( 'edittoken', 
self::$loginUser );
                return $this->doApiRequest( $params, $session, false, $user );
        }
 
@@ -298,11 +290,10 @@
                }
 
                self::initEntities();
-               $token = $this->getEditToken();
 
                foreach ( self::$entityInput as $entity ) {
                        $handle = $entity['handle'];
-                       $createdEntity = $this->setEntity( $entity, $token );
+                       $createdEntity = $this->setEntity( $entity, 
self::getToken( 'edittoken', self::$loginUser ) );
 
                        self::$entityOutput[ $handle ] = $createdEntity;
                }
@@ -313,12 +304,11 @@
         */
        function resetEntities() {
                $this->createEntities();
-               $token = $this->getEditToken();
 
                foreach ( self::$entityInput as $handle => $entity ) {
                        $entity['id'] = $this->getEntityId( $handle );
 
-                       $data = $this->setEntity( $entity, $token );
+                       $data = $this->setEntity( $entity, self::getToken( 
'edittoken', self::$loginUser ) );
 
                        self::$entityOutput[ $handle ] = $data;
                }
@@ -331,7 +321,7 @@
                $entity = $this->getEntityInput( $handle );
                $entity['id'] = $this->getEntityId( $handle );
 
-               $token = $this->getEditToken();
+               $token = self::getToken( 'edittoken', self::$loginUser );
                $data = $this->setEntity( $entity, $token );
 
                self::$entityOutput[ $handle ] = $data;

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Iaa949bae696dad98756e6c99b910e22eb476b0bc
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Wikibase
Gerrit-Branch: master
Gerrit-Owner: Addshore <[email protected]>

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

Reply via email to