X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=tests%2Fphpunit%2Fincludes%2Fuser%2FLocalIdLookupTest.php;h=c86fb6cff3fb65d082244701b7c42425c4a5383e;hb=d7bad7704f67dc887a77e4de7581931b7915d04b;hp=2bea575c7545463af675b286e91ede02014f8a59;hpb=1d489846c1691d2ba93220e09891c990543dabb1;p=lhc%2Fweb%2Fwiklou.git diff --git a/tests/phpunit/includes/user/LocalIdLookupTest.php b/tests/phpunit/includes/user/LocalIdLookupTest.php index 2bea575c75..c86fb6cff3 100644 --- a/tests/phpunit/includes/user/LocalIdLookupTest.php +++ b/tests/phpunit/includes/user/LocalIdLookupTest.php @@ -5,14 +5,14 @@ * @group Database */ class LocalIdLookupTest extends MediaWikiTestCase { - private $localUsers = array(); + private $localUsers = []; protected function setUp() { global $wgGroupPermissions; parent::setUp(); - $this->stashMwGlobals( array( 'wgGroupPermissions' ) ); + $this->stashMwGlobals( [ 'wgGroupPermissions' ] ); $wgGroupPermissions['local-id-lookup-test']['hideuser'] = true; } @@ -27,22 +27,22 @@ class LocalIdLookupTest extends MediaWikiTestCase { User::newFromName( 'UTLocalIdLookup1' )->addGroup( 'local-id-lookup-test' ); - $block = new Block( array( + $block = new Block( [ 'address' => 'UTLocalIdLookup3', 'by' => User::idFromName( 'UTSysop' ), 'reason' => __METHOD__, 'expiry' => '1 day', 'hideName' => false, - ) ); + ] ); $block->insert(); - $block = new Block( array( + $block = new Block( [ 'address' => 'UTLocalIdLookup4', 'by' => User::idFromName( 'UTSysop' ), 'reason' => __METHOD__, 'expiry' => '1 day', 'hideName' => true, - ) ); + ] ); $block->insert(); } @@ -54,7 +54,7 @@ class LocalIdLookupTest extends MediaWikiTestCase { $this->assertTrue( $user1->isAllowed( 'hideuser' ), 'sanity check' ); $this->assertFalse( $user2->isAllowed( 'hideuser' ), 'sanity check' ); - $this->assertSame( array(), $lookup->lookupCentralIds( array() ) ); + $this->assertSame( [], $lookup->lookupCentralIds( [] ) ); $expect = array_flip( $this->localUsers ); $expect[123] = 'X'; @@ -79,7 +79,7 @@ class LocalIdLookupTest extends MediaWikiTestCase { $this->assertTrue( $user1->isAllowed( 'hideuser' ), 'sanity check' ); $this->assertFalse( $user2->isAllowed( 'hideuser' ), 'sanity check' ); - $this->assertSame( array(), $lookup->lookupUserNames( array() ) ); + $this->assertSame( [], $lookup->lookupUserNames( [] ) ); $expect = $this->localUsers; $expect['UTDoesNotExist'] = 'X'; @@ -104,11 +104,11 @@ class LocalIdLookupTest extends MediaWikiTestCase { $this->assertTrue( $lookup->isAttached( $user1 ) ); $this->assertFalse( $lookup->isAttached( $user2 ) ); - $wiki = wfWikiId(); + $wiki = wfWikiID(); $this->assertTrue( $lookup->isAttached( $user1, $wiki ) ); $this->assertFalse( $lookup->isAttached( $user2, $wiki ) ); - $wiki = 'not-' . wfWikiId(); + $wiki = 'not-' . wfWikiID(); $this->assertFalse( $lookup->isAttached( $user1, $wiki ) ); $this->assertFalse( $lookup->isAttached( $user2, $wiki ) ); } @@ -121,11 +121,11 @@ class LocalIdLookupTest extends MediaWikiTestCase { */ public function testIsAttachedShared( $sharedDB, $sharedTable, $localDBSet ) { global $wgDBName; - $this->setMwGlobals( array( + $this->setMwGlobals( [ 'wgSharedDB' => $sharedDB ? $wgDBName : null, - 'wgSharedTables' => $sharedTable ? array( 'user' ) : array(), - 'wgLocalDatabases' => $localDBSet ? array( 'shared' ) : array(), - ) ); + 'wgSharedTables' => $sharedTable ? [ 'user' ] : [], + 'wgLocalDatabases' => $localDBSet ? [ 'shared' ] : [], + ] ); $lookup = new LocalIdLookup(); $this->assertSame( @@ -135,13 +135,13 @@ class LocalIdLookupTest extends MediaWikiTestCase { } public static function provideIsAttachedShared() { - $ret = array(); + $ret = []; for ( $i = 0; $i < 7; $i++ ) { - $ret[] = array( + $ret[] = [ (bool)( $i & 1 ), (bool)( $i & 2 ), (bool)( $i & 4 ), - ); + ]; } return $ret; }