Aude has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/343456 )

Change subject: Don't create user in AuthManagerTest dataProvider
......................................................................

Don't create user in AuthManagerTest dataProvider

Creating users involves database access and the test
database isn't fully setup yet when data providers run.

In this particular test / data provider, all that is needed
is the user name so we can just set that w/o creating
the user in the data provider. The user gets created during
the test. (after the test database is setup)

also $id set in $id = $user->getId() was unused and was the
specific code that involved making a database connection.

Change-Id: I1685dfdd6cfc60cd2c59a4d9de95bcbbaba5e153
---
M tests/phpunit/includes/auth/AuthManagerTest.php
1 file changed, 7 insertions(+), 9 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/56/343456/1

diff --git a/tests/phpunit/includes/auth/AuthManagerTest.php 
b/tests/phpunit/includes/auth/AuthManagerTest.php
index f57db11..f7be801 100644
--- a/tests/phpunit/includes/auth/AuthManagerTest.php
+++ b/tests/phpunit/includes/auth/AuthManagerTest.php
@@ -1083,10 +1083,6 @@
        }
 
        public function provideAuthentication() {
-               $user = \User::newFromName( 'UTSysop' );
-               $id = $user->getId();
-               $name = $user->getName();
-
                $rememberReq = new RememberMeAuthenticationRequest;
                $rememberReq->action = AuthManager::ACTION_LOGIN;
 
@@ -1107,6 +1103,8 @@
                );
                $restartResponse2->createRequest->action = 
AuthManager::ACTION_LOGIN;
                $restartResponse2->neededRequests = [ $rememberReq, 
$restartResponse2->createRequest ];
+
+               $userName = 'UTSysop';
 
                return [
                        'Failure in pre-auth' => [
@@ -1202,7 +1200,7 @@
                        'Secondary fail' => [
                                StatusValue::newGood(),
                                [
-                                       AuthenticationResponse::newPass( $name 
),
+                                       AuthenticationResponse::newPass( 
$userName ),
                                ],
                                $tmp = [
                                        AuthenticationResponse::newFail( 
$this->message( 'fail-in-secondary' ) ),
@@ -1212,7 +1210,7 @@
                        'Secondary UI, then abstain' => [
                                StatusValue::newGood(),
                                [
-                                       AuthenticationResponse::newPass( $name 
),
+                                       AuthenticationResponse::newPass( 
$userName ),
                                ],
                                [
                                        $tmp = AuthenticationResponse::newUI( [ 
$req ], $this->message( '...' ) ),
@@ -1220,19 +1218,19 @@
                                ],
                                [
                                        $tmp,
-                                       AuthenticationResponse::newPass( $name 
),
+                                       AuthenticationResponse::newPass( 
$userName ),
                                ]
                        ],
                        'Secondary pass' => [
                                StatusValue::newGood(),
                                [
-                                       AuthenticationResponse::newPass( $name 
),
+                                       AuthenticationResponse::newPass( 
$userName ),
                                ],
                                [
                                        AuthenticationResponse::newPass()
                                ],
                                [
-                                       AuthenticationResponse::newPass( $name 
),
+                                       AuthenticationResponse::newPass( 
$userName ),
                                ]
                        ],
                ];

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I1685dfdd6cfc60cd2c59a4d9de95bcbbaba5e153
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Aude <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

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

Reply via email to