X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=tests%2Fphpunit%2Fincludes%2Fsession%2FBotPasswordSessionProviderTest.php;h=9bc41c06b3be3814ddb19cc3fdff99e98a7dd11d;hb=425090d4eb0b9de89ad6818f40ab8295368f645e;hp=edab0dcf4ab7fc04572164f7619e20128dfd70a5;hpb=75cdcc94007dca953927b13db411aac94750b074;p=lhc%2Fweb%2Fwiklou.git diff --git a/tests/phpunit/includes/session/BotPasswordSessionProviderTest.php b/tests/phpunit/includes/session/BotPasswordSessionProviderTest.php index edab0dcf4a..9bc41c06b3 100644 --- a/tests/phpunit/includes/session/BotPasswordSessionProviderTest.php +++ b/tests/phpunit/includes/session/BotPasswordSessionProviderTest.php @@ -65,11 +65,10 @@ class BotPasswordSessionProviderTest extends MediaWikiTestCase { public function addDBDataOnce() { $passwordFactory = new \PasswordFactory(); $passwordFactory->init( \RequestContext::getMain()->getConfig() ); - // A is unsalted MD5 (thus fast) ... we don't care about security here, this is test only - $passwordFactory->setDefaultType( 'A' ); - $pwhash = $passwordFactory->newFromPlaintext( 'foobaz' ); + $passwordHash = $passwordFactory->newFromPlaintext( 'foobaz' ); - $userId = \CentralIdLookup::factory( 'local' )->centralIdFromName( 'UTSysop' ); + $sysop = static::getTestSysop()->getUser(); + $userId = \CentralIdLookup::factory( 'local' )->centralIdFromName( $sysop->getName() ); $dbw = wfGetDB( DB_MASTER ); $dbw->delete( @@ -82,7 +81,7 @@ class BotPasswordSessionProviderTest extends MediaWikiTestCase { [ 'bp_user' => $userId, 'bp_app_id' => 'BotPasswordSessionProvider', - 'bp_password' => $pwhash->toString(), + 'bp_password' => $passwordHash->toString(), 'bp_token' => 'token!', 'bp_restrictions' => '{"IPAddresses":["127.0.0.0/8"]}', 'bp_grants' => '["test"]', @@ -184,7 +183,7 @@ class BotPasswordSessionProviderTest extends MediaWikiTestCase { public function testNewSessionInfoForRequest() { $provider = $this->getProvider(); - $user = \User::newFromName( 'UTSysop' ); + $user = static::getTestSysop()->getUser(); $request = $this->getMock( 'FauxRequest', [ 'getIP' ] ); $request->expects( $this->any() )->method( 'getIP' ) ->will( $this->returnValue( '127.0.0.1' ) ); @@ -211,7 +210,7 @@ class BotPasswordSessionProviderTest extends MediaWikiTestCase { $provider = $this->getProvider(); $provider->setLogger( $logger ); - $user = \User::newFromName( 'UTSysop' ); + $user = static::getTestSysop()->getUser(); $request = $this->getMock( 'FauxRequest', [ 'getIP' ] ); $request->expects( $this->any() )->method( 'getIP' ) ->will( $this->returnValue( '127.0.0.1' ) );