X-Git-Url: http://git.cyclocoop.org/?a=blobdiff_plain;f=tests%2Fphpunit%2Fincludes%2Fuser%2FCentralIdLookupTest.php;h=dc9fe2add8d2fd3e61220e388ea21695d8a44764;hb=87169fffd87903fab5755be93cfd0df3a4c15948;hp=feac641eb3056fa626c69af17c201cd1054804c4;hpb=f43fa6f4f0e2cb60b8543daad661b48a3e0653a9;p=lhc%2Fweb%2Fwiklou.git diff --git a/tests/phpunit/includes/user/CentralIdLookupTest.php b/tests/phpunit/includes/user/CentralIdLookupTest.php index feac641eb3..dc9fe2add8 100644 --- a/tests/phpunit/includes/user/CentralIdLookupTest.php +++ b/tests/phpunit/includes/user/CentralIdLookupTest.php @@ -1,5 +1,7 @@ getMockForAbstractClass( 'CentralIdLookup' ); + $mock = $this->getMockForAbstractClass( CentralIdLookup::class ); $this->setMwGlobals( [ 'wgCentralIdLookupProviders' => [ - 'local' => [ 'class' => 'LocalIdLookup' ], - 'local2' => [ 'class' => 'LocalIdLookup' ], + 'local' => [ 'class' => LocalIdLookup::class ], + 'local2' => [ 'class' => LocalIdLookup::class ], 'mock' => [ 'factory' => function () use ( $mock ) { return $mock; } ], - 'bad' => [ 'class' => 'stdClass' ], + 'bad' => [ 'class' => stdClass::class ], ], 'wgCentralIdLookupProvider' => 'mock', ] ); @@ -27,13 +29,13 @@ class CentralIdLookupTest extends MediaWikiTestCase { $local = CentralIdLookup::factory( 'local' ); $this->assertNotSame( $mock, $local ); - $this->assertInstanceOf( 'LocalIdLookup', $local ); + $this->assertInstanceOf( LocalIdLookup::class, $local ); $this->assertSame( $local, CentralIdLookup::factory( 'local' ) ); $this->assertSame( 'local', $local->getProviderId() ); $local2 = CentralIdLookup::factory( 'local2' ); $this->assertNotSame( $local, $local2 ); - $this->assertInstanceOf( 'LocalIdLookup', $local2 ); + $this->assertInstanceOf( LocalIdLookup::class, $local2 ); $this->assertSame( 'local2', $local2->getProviderId() ); $this->assertNull( CentralIdLookup::factory( 'unconfigured' ) ); @@ -42,14 +44,14 @@ class CentralIdLookupTest extends MediaWikiTestCase { public function testCheckAudience() { $mock = TestingAccessWrapper::newFromObject( - $this->getMockForAbstractClass( 'CentralIdLookup' ) + $this->getMockForAbstractClass( CentralIdLookup::class ) ); $user = static::getTestSysop()->getUser(); $this->assertSame( $user, $mock->checkAudience( $user ) ); $user = $mock->checkAudience( CentralIdLookup::AUDIENCE_PUBLIC ); - $this->assertInstanceOf( 'User', $user ); + $this->assertInstanceOf( User::class, $user ); $this->assertSame( 0, $user->getId() ); $this->assertNull( $mock->checkAudience( CentralIdLookup::AUDIENCE_RAW ) ); @@ -63,7 +65,7 @@ class CentralIdLookupTest extends MediaWikiTestCase { } public function testNameFromCentralId() { - $mock = $this->getMockForAbstractClass( 'CentralIdLookup' ); + $mock = $this->getMockForAbstractClass( CentralIdLookup::class ); $mock->expects( $this->once() )->method( 'lookupCentralIds' ) ->with( $this->equalTo( [ 15 => null ] ), @@ -84,7 +86,7 @@ class CentralIdLookupTest extends MediaWikiTestCase { * @param bool $succeeds */ public function testLocalUserFromCentralId( $name, $succeeds ) { - $mock = $this->getMockForAbstractClass( 'CentralIdLookup' ); + $mock = $this->getMockForAbstractClass( CentralIdLookup::class ); $mock->expects( $this->any() )->method( 'isAttached' ) ->will( $this->returnValue( true ) ); $mock->expects( $this->once() )->method( 'lookupCentralIds' ) @@ -99,13 +101,13 @@ class CentralIdLookupTest extends MediaWikiTestCase { 42, CentralIdLookup::AUDIENCE_RAW, CentralIdLookup::READ_LATEST ); if ( $succeeds ) { - $this->assertInstanceOf( 'User', $user ); + $this->assertInstanceOf( User::class, $user ); $this->assertSame( $name, $user->getName() ); } else { $this->assertNull( $user ); } - $mock = $this->getMockForAbstractClass( 'CentralIdLookup' ); + $mock = $this->getMockForAbstractClass( CentralIdLookup::class ); $mock->expects( $this->any() )->method( 'isAttached' ) ->will( $this->returnValue( false ) ); $mock->expects( $this->once() )->method( 'lookupCentralIds' ) @@ -131,7 +133,7 @@ class CentralIdLookupTest extends MediaWikiTestCase { } public function testCentralIdFromName() { - $mock = $this->getMockForAbstractClass( 'CentralIdLookup' ); + $mock = $this->getMockForAbstractClass( CentralIdLookup::class ); $mock->expects( $this->once() )->method( 'lookupUserNames' ) ->with( $this->equalTo( [ 'FooBar' => 0 ] ), @@ -147,7 +149,7 @@ class CentralIdLookupTest extends MediaWikiTestCase { } public function testCentralIdFromLocalUser() { - $mock = $this->getMockForAbstractClass( 'CentralIdLookup' ); + $mock = $this->getMockForAbstractClass( CentralIdLookup::class ); $mock->expects( $this->any() )->method( 'isAttached' ) ->will( $this->returnValue( true ) ); $mock->expects( $this->once() )->method( 'lookupUserNames' ) @@ -165,7 +167,7 @@ class CentralIdLookupTest extends MediaWikiTestCase { ) ); - $mock = $this->getMockForAbstractClass( 'CentralIdLookup' ); + $mock = $this->getMockForAbstractClass( CentralIdLookup::class ); $mock->expects( $this->any() )->method( 'isAttached' ) ->will( $this->returnValue( false ) ); $mock->expects( $this->never() )->method( 'lookupUserNames' );