X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=tests%2Fphpunit%2Fincludes%2Fauth%2FAuthManagerTest.php;h=dc6fc62c3d23b1d5cf1873173ccc01750cf773df;hb=9de4779e206628d8c7c9ae76785bfe825b5267d5;hp=99b9029bc343901b8b0954d1f7cb76b238da5cb4;hpb=3cfcd55011244c0767079bf4dbeb0dcc2345d34c;p=lhc%2Fweb%2Fwiklou.git diff --git a/tests/phpunit/includes/auth/AuthManagerTest.php b/tests/phpunit/includes/auth/AuthManagerTest.php index 99b9029bc3..dc6fc62c3d 100644 --- a/tests/phpunit/includes/auth/AuthManagerTest.php +++ b/tests/phpunit/includes/auth/AuthManagerTest.php @@ -2674,7 +2674,7 @@ class AuthManagerTest extends \MediaWikiTestCase { $this->assertEquals( 0, $session->getUser()->getId() ); $this->assertSame( [ [ LogLevel::INFO, 'creating new user ({username}) - from: {from}' ], - [ LogLevel::ERROR, '{username} failed with message {message}' ], + [ LogLevel::ERROR, '{username} failed with message {msg}' ], ], $logger->getBuffer() ); $logger->clearBuffer(); $this->assertSame( null, $session->get( 'AuthManager::AutoCreateBlacklist' ) ); @@ -2709,9 +2709,11 @@ class AuthManagerTest extends \MediaWikiTestCase { $session->clear(); $user = $this->getMock( 'User', [ 'addToDatabase' ] ); $user->expects( $this->once() )->method( 'addToDatabase' ) - ->will( $this->returnCallback( function () use ( $username ) { - $status = \User::newFromName( $username )->addToDatabase(); + ->will( $this->returnCallback( function () use ( $username, &$user ) { + $oldUser = \User::newFromName( $username ); + $status = $oldUser->addToDatabase(); $this->assertTrue( $status->isOK(), 'sanity check' ); + $user->setId( $oldUser->getId() ); return \Status::newFatal( 'userexists' ); } ) ); $user->setName( $username ); @@ -3087,7 +3089,7 @@ class AuthManagerTest extends \MediaWikiTestCase { $actual = $this->manager->getAuthenticationRequests( AuthManager::ACTION_LOGIN ); $expected = [ $rememberReq, - $makeReq( "primary-shared", AuthenticationRequest::REQUIRED ), + $makeReq( "primary-shared", AuthenticationRequest::PRIMARY_REQUIRED ), $makeReq( "required", AuthenticationRequest::PRIMARY_REQUIRED ), $makeReq( "required2", AuthenticationRequest::PRIMARY_REQUIRED ), $makeReq( "optional", AuthenticationRequest::OPTIONAL ), @@ -3107,10 +3109,10 @@ class AuthManagerTest extends \MediaWikiTestCase { $actual = $this->manager->getAuthenticationRequests( AuthManager::ACTION_LOGIN ); $expected = [ $rememberReq, - $makeReq( "primary-shared", AuthenticationRequest::REQUIRED ), - $makeReq( "required", AuthenticationRequest::REQUIRED ), + $makeReq( "primary-shared", AuthenticationRequest::PRIMARY_REQUIRED ), + $makeReq( "required", AuthenticationRequest::PRIMARY_REQUIRED ), $makeReq( "optional", AuthenticationRequest::OPTIONAL ), - $makeReq( "foo", AuthenticationRequest::REQUIRED ), + $makeReq( "foo", AuthenticationRequest::PRIMARY_REQUIRED ), $makeReq( "bar", AuthenticationRequest::REQUIRED ), $makeReq( "baz", AuthenticationRequest::REQUIRED ), ];