Ori.livneh has uploaded a new change for review.

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

Change subject: Update tests for I17ef1f519
......................................................................

Update tests for I17ef1f519

This is a prerequisite for I17ef1f519, since the tests break otherwise. The
change is backward-compatible since it's checks for the presence of the
getTestUser method introduced by that change.

Change-Id: I8bbc9ebf32a89157fa9c60fd33151a10e7598af8
---
M tests/ApiFlowThankIntegrationTest.php
1 file changed, 13 insertions(+), 4 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Thanks 
refs/changes/80/290380/1

diff --git a/tests/ApiFlowThankIntegrationTest.php 
b/tests/ApiFlowThankIntegrationTest.php
index 7ee6e0e..021ab31 100644
--- a/tests/ApiFlowThankIntegrationTest.php
+++ b/tests/ApiFlowThankIntegrationTest.php
@@ -22,6 +22,8 @@
         * @var PostRevision
         */
        public $topic,
+               $meUser,
+               $otherUser,
                $postByOtherUser,
                $postByMe;
 
@@ -33,13 +35,20 @@
                }
 
                // mock topic and post
+               if ( method_exists( $this, 'getTestUser' ) ) {
+                       $this->meUser = $this->getTestUser( true )->getUser();
+                       $this->otherUser = $this->getTestUser( true 
)->getUser();
+               } else {
+                       $this->meUser = self::$users[ 'sysop' ]->getUser();
+                       $this->otherUser = self::$users[ 'uploader' 
]->getUser();
+               }
                $this->topic = $this->generateObject();
                $this->postByOtherUser = $this->generateObject( [
-                               'tree_orig_user_id' => self::$users[ 'uploader' 
]->getUser()->getId(),
+                               'tree_orig_user_id' => 
$this->otherUser->getId(),
                                'tree_parent_id' => 
$this->topic->getPostId()->getBinary(),
                        ], [], 1 );
                $this->postByMe = $this->generateObject( [
-                               'tree_orig_user_id' => self::$users[ 'sysop' 
]->getUser()->getId(),
+                               'tree_orig_user_id' => $this->meUser->getId(),
                                'tree_parent_id' => 
$this->topic->getPostId()->getBinary(),
                        ], [], 1 );
 
@@ -138,7 +147,7 @@
                list( $result,, ) = $this->doApiRequestWithToken( [
                        'action' => 'flowthank',
                        'postid' => 
$this->postByMe->getPostId()->getAlphadecimal(),
-               ] );
+               ], null, $this->meUser );
        }
 
        protected function assertSuccess( $result ) {
@@ -162,7 +171,7 @@
                $uuidPost = UUID::create();
                $uuidRevision = UUID::create();
 
-               $user = User::newFromName( 'UTSysop' );
+               $user = $this->getTestUser()->getUser();
                $userId = $user->getId();
                $userIp = null;
 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I8bbc9ebf32a89157fa9c60fd33151a10e7598af8
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Thanks
Gerrit-Branch: master
Gerrit-Owner: Ori.livneh <o...@wikimedia.org>

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

Reply via email to