3define(
'NS_UNITTEST', 5600 );
4define(
'NS_UNITTEST_TALK', 5601 );
7use Wikimedia\TestingAccessWrapper;
22 'wgGroupPermissions' => [],
23 'wgRevokePermissions' => [],
28 $this->user = $this->
getTestUser( [
'unittesters' ] )->getUser();
34 # Data for regular $wgGroupPermissions test
47 # Data for regular $wgRevokePermissions test
52 # For the options test
54 'editmyoptions' =>
true,
62 $rights = User::getGroupPermissions( [
'unittesters' ] );
63 $this->assertContains(
'runtest', $rights );
64 $this->assertNotContains(
'writetest', $rights );
65 $this->assertNotContains(
'modifytest', $rights );
66 $this->assertNotContains(
'nukeworld', $rights );
68 $rights = User::getGroupPermissions( [
'unittesters',
'testwriters' ] );
69 $this->assertContains(
'runtest', $rights );
70 $this->assertContains(
'writetest', $rights );
71 $this->assertContains(
'modifytest', $rights );
72 $this->assertNotContains(
'nukeworld', $rights );
79 $rights = User::getGroupPermissions( [
'unittesters',
'formertesters' ] );
80 $this->assertNotContains(
'runtest', $rights );
81 $this->assertNotContains(
'writetest', $rights );
82 $this->assertNotContains(
'modifytest', $rights );
83 $this->assertNotContains(
'nukeworld', $rights );
90 $rights = $this->user->getRights();
91 $this->assertContains(
'runtest', $rights );
92 $this->assertNotContains(
'writetest', $rights );
93 $this->assertNotContains(
'modifytest', $rights );
94 $this->assertNotContains(
'nukeworld', $rights );
101 $user = $this->
getTestUser( [
'unittesters',
'testwriters' ] )->getUser();
102 $userWrapper = TestingAccessWrapper::newFromObject( $user );
104 $rights = $user->getRights();
105 $this->assertContains(
'test', $rights,
'sanity check' );
106 $this->assertContains(
'runtest', $rights,
'sanity check' );
107 $this->assertContains(
'writetest', $rights,
'sanity check' );
108 $this->assertNotContains(
'nukeworld', $rights,
'sanity check' );
112 $rights[] =
'nukeworld';
113 $rights = array_diff( $rights, [
'writetest' ] );
116 $userWrapper->mRights =
null;
117 $rights = $user->getRights();
118 $this->assertContains(
'test', $rights );
119 $this->assertContains(
'runtest', $rights );
120 $this->assertNotContains(
'writetest', $rights );
121 $this->assertContains(
'nukeworld', $rights );
124 $mock = $this->getMockBuilder( stdclass::class )
125 ->setMethods( [
'getAllowedUserRights',
'deregisterSession',
'getSessionId' ] )
127 $mock->method(
'getAllowedUserRights' )->willReturn( [
'test',
'writetest' ] );
128 $mock->method(
'getSessionId' )->willReturn(
129 new MediaWiki\Session\SessionId( str_repeat(
'X', 32 ) )
131 $session = MediaWiki\Session\TestUtils::getDummySession( $mock );
132 $mockRequest = $this->getMockBuilder( FauxRequest::class )
133 ->setMethods( [
'getSession' ] )
135 $mockRequest->method(
'getSession' )->willReturn( $session );
136 $userWrapper->mRequest = $mockRequest;
138 $userWrapper->mRights =
null;
139 $rights = $user->getRights();
140 $this->assertContains(
'test', $rights );
141 $this->assertNotContains(
'runtest', $rights );
142 $this->assertNotContains(
'writetest', $rights );
143 $this->assertNotContains(
'nukeworld', $rights );
151 $result = User::getGroupsWithPermission( $right );
155 $this->assertEquals( $expected, $result,
"Groups with permission $right" );
161 [
'unittesters',
'testwriters' ],
184 $this->assertEquals( $this->user->isIP(
$value ), $result, $message );
189 [
'',
false,
'Empty string' ],
190 [
' ',
false,
'Blank space' ],
191 [
'10.0.0.0',
true,
'IPv4 private 10/8' ],
192 [
'10.255.255.255',
true,
'IPv4 private 10/8' ],
193 [
'192.168.1.1',
true,
'IPv4 private 192.168/16' ],
194 [
'203.0.113.0',
true,
'IPv4 example' ],
195 [
'2002:ffff:ffff:ffff:ffff:ffff:ffff:ffff',
true,
'IPv6 example' ],
199 [
'300.300.300.300',
true,
'Looks too much like an IPv4 address' ],
200 [
'203.0.113.xxx',
true,
'Assigned by UseMod to cloaked logged-out users' ],
209 $this->assertEquals( $this->user->isValidUserName(
$username ), $result, $message );
214 [
'',
false,
'Empty string' ],
215 [
' ',
false,
'Blank space' ],
216 [
'abcd',
false,
'Starts with small letter' ],
217 [
'Ab/cd',
false,
'Contains slash' ],
218 [
'Ab cd',
true,
'Whitespace' ],
219 [
'192.168.1.1',
false,
'IP' ],
220 [
'116.17.184.5/32',
false,
'IP range' ],
221 [
'::e:f:2001/96',
false,
'IPv6 range' ],
222 [
'User:Abcd',
false,
'Reserved Namespace' ],
223 [
'12abcd232',
true,
'Starts with Numbers' ],
224 [
'?abcd',
true,
'Start with ? mark' ],
225 [
'#abcd',
false,
'Start with #' ],
226 [
'Abcdകഖഗഘ',
true,
' Mixed scripts' ],
227 [
'ജോസ്തോമസ്',
false,
'ZWNJ- Format control character' ],
228 [
'Ab cd',
false,
' Ideographic space' ],
229 [
'300.300.300.300',
false,
'Looks too much like an IPv4 address' ],
230 [
'302.113.311.900',
false,
'Looks too much like an IPv4 address' ],
231 [
'203.0.113.xxx',
false,
'Reserved for usage by UseMod for cloaked logged-out users' ],
242 $allRights = User::getAllRights();
243 $allMessageKeys = Language::getMessageKeysFor(
'en' );
245 $rightsWithMessage = [];
246 foreach ( $allMessageKeys as $message ) {
248 if ( strpos( $message,
'right-' ) === 0 ) {
249 $rightsWithMessage[] = substr( $message, strlen(
'right-' ) );
254 sort( $rightsWithMessage );
259 'Each user rights (core/extensions) has a corresponding right- message.'
273 for ( $i = 0; $i < 3; $i++ ) {
274 $page->doEditContent(
285 $user->getEditCount(),
286 'After three edits, the user edit count should be 3'
290 $user->incEditCount();
294 $user->getEditCount(),
295 'After increasing the edit count manually, the user edit count should be 4'
305 $user = User::newFromName(
'Anonymous' );
308 $user->getEditCount(),
309 'Edit count starts null for anonymous users.'
312 $user->incEditCount();
315 $user->getEditCount(),
316 'Edit count remains null for anonymous users despite calls to increase it.'
327 $user->incEditCount();
329 $reloadedUser = User::newFromId( $user->getId() );
330 $reloadedUser->incEditCount();
334 $reloadedUser->getEditCount(),
335 'Increasing the edit count after a fresh load leaves the object up to date.'
347 $user->setOption(
'userjs-someoption',
'test' );
348 $user->setOption(
'rclimit', 200 );
349 $user->saveSettings();
351 $user = User::newFromName( $user->getName() );
352 $user->load( User::READ_LATEST );
353 $this->assertEquals(
'test', $user->getOption(
'userjs-someoption' ) );
354 $this->assertEquals( 200, $user->getOption(
'rclimit' ) );
356 $user = User::newFromName( $user->getName() );
357 MediaWikiServices::getInstance()->getMainWANObjectCache()->clearProcessCache();
358 $this->assertEquals(
'test', $user->getOption(
'userjs-someoption' ) );
359 $this->assertEquals( 200, $user->getOption(
'rclimit' ) );
369 $this->user->setOption(
'userjs-someoption',
'test' );
371 $this->assertEquals(
'test', $this->user->getOption(
'userjs-someoption' ) );
385 'wgPasswordPolicy' => [
388 'MinimalPasswordLength' => 8,
389 'MinimumPasswordLengthToLogin' => 1,
390 'PasswordCannotMatchUsername' => 1,
393 'MinimalPasswordLength' => 6,
394 'PasswordCannotMatchUsername' =>
true,
395 'PasswordCannotMatchBlacklist' =>
true,
396 'MaximalPasswordLength' => 40,
400 'MinimalPasswordLength' =>
'PasswordPolicyChecks::checkMinimalPasswordLength',
401 'MinimumPasswordLengthToLogin' =>
'PasswordPolicyChecks::checkMinimumPasswordLengthToLogin',
402 'PasswordCannotMatchUsername' =>
'PasswordPolicyChecks::checkPasswordCannotMatchUsername',
403 'PasswordCannotMatchBlacklist' =>
'PasswordPolicyChecks::checkPasswordCannotMatchBlacklist',
404 'MaximalPasswordLength' =>
'PasswordPolicyChecks::checkMaximalPasswordLength',
409 $user = static::getTestUser()->getUser();
412 $this->assertTrue( $user->isValidPassword(
'Password1234' ) );
415 $this->assertFalse( $user->isValidPassword(
'a' ) );
416 $this->assertFalse( $user->checkPasswordValidity(
'a' )->isGood() );
417 $this->assertTrue( $user->checkPasswordValidity(
'a' )->isOK() );
418 $this->assertEquals(
'passwordtooshort', $user->getPasswordValidity(
'a' ) );
421 $longPass = str_repeat(
'a', 41 );
422 $this->assertFalse( $user->isValidPassword( $longPass ) );
423 $this->assertFalse( $user->checkPasswordValidity( $longPass )->isGood() );
424 $this->assertFalse( $user->checkPasswordValidity( $longPass )->isOK() );
425 $this->assertEquals(
'passwordtoolong', $user->getPasswordValidity( $longPass ) );
428 $this->assertFalse( $user->checkPasswordValidity( $user->getName() )->isGood() );
429 $this->assertTrue( $user->checkPasswordValidity( $user->getName() )->isOK() );
430 $this->assertEquals(
'password-name-match', $user->getPasswordValidity( $user->getName() ) );
433 $user = User::newFromName(
'Useruser' );
434 $this->assertFalse( $user->checkPasswordValidity(
'Passpass' )->isGood() );
435 $this->assertEquals(
'password-login-forbidden', $user->getPasswordValidity(
'Passpass' ) );
445 'InterwikiLoadPrefix' => [
446 function ( $prefix, &$iwdata ) {
447 if ( $prefix ===
'interwiki' ) {
449 'iw_url' =>
'http://example.com/',
459 foreach ( $expectedArray as $validate => $expected ) {
462 User::getCanonicalName( $name, $validate ===
'false' ?
false : $validate ), $validate );
468 'Leading space' => [
' Leading space', [
'creatable' =>
'Leading space' ] ],
469 'Trailing space ' => [
'Trailing space ', [
'creatable' =>
'Trailing space' ] ],
470 'Namespace prefix' => [
'Talk:Username', [
'creatable' =>
false,
'usable' =>
false,
471 'valid' =>
false,
'false' =>
'Talk:Username' ] ],
472 'Interwiki prefix' => [
'interwiki:Username', [
'creatable' =>
false,
'usable' =>
false,
473 'valid' =>
false,
'false' =>
'Interwiki:Username' ] ],
474 'With hash' => [
'name with # hash', [
'creatable' =>
false,
'usable' =>
false ] ],
475 'Multi spaces' => [
'Multi spaces', [
'creatable' =>
'Multi spaces',
476 'usable' =>
'Multi spaces' ] ],
477 'Lowercase' => [
'lowercase', [
'creatable' =>
'Lowercase' ] ],
478 'Invalid character' => [
'in[]valid', [
'creatable' =>
false,
'usable' =>
false,
479 'valid' =>
false,
'false' =>
'In[]valid' ] ],
480 'With slash' => [
'with / slash', [
'creatable' =>
false,
'usable' =>
false,
'valid' =>
false,
481 'false' =>
'With / slash' ] ],
490 $second = User::newFromName( $first->getName() );
492 $this->assertTrue( $first->equals( $first ) );
493 $this->assertTrue( $first->equals( $second ) );
494 $this->assertTrue( $second->equals( $first ) );
499 $this->assertFalse( $third->equals( $fourth ) );
500 $this->assertFalse( $fourth->equals( $third ) );
504 $fifth = User::newFromId( $user->getId() );
505 $sixth = User::newFromName( $user->getName() );
506 $this->assertTrue( $fifth->equals( $sixth ) );
513 $user = static::getTestUser()->getUser();
514 $this->assertTrue( $user->getId() > 0 );
523 $this->assertTrue( $user->isLoggedIn() );
524 $this->assertFalse( $user->isAnon() );
527 $user = User::newFromName(
'UTNonexistent' );
528 $this->assertFalse( $user->isLoggedIn() );
529 $this->assertTrue( $user->isAnon() );
532 $this->assertFalse( $user->isLoggedIn() );
533 $this->assertTrue( $user->isAnon() );
541 $user = TestingAccessWrapper::newFromObject( $user );
542 $this->assertTrue( $user->isLoggedIn() );
544 $touched = $user->getDBTouched();
546 $user->checkAndSetTouched(),
"checkAndSetTouched() succeded" );
547 $this->assertGreaterThan(
548 $touched, $user->getDBTouched(),
"user_touched increased with casOnTouched()" );
550 $touched = $user->getDBTouched();
552 $user->checkAndSetTouched(),
"checkAndSetTouched() succeded #2" );
553 $this->assertGreaterThan(
554 $touched, $user->getDBTouched(),
"user_touched increased with casOnTouched() #2" );
561 $users = User::findUsersByGroup( [] );
562 $this->assertEquals( 0, iterator_count(
$users ) );
564 $users = User::findUsersByGroup(
'foo' );
565 $this->assertEquals( 0, iterator_count(
$users ) );
568 $users = User::findUsersByGroup(
'foo' );
569 $this->assertEquals( 1, iterator_count(
$users ) );
571 $this->assertTrue( $user->equals(
$users->current() ) );
575 $users = User::findUsersByGroup( [
'foo',
'bar' ] );
576 $this->assertEquals( 2, iterator_count(
$users ) );
578 $this->assertTrue( $user->equals(
$users->current() ) );
580 $this->assertTrue( $user2->equals(
$users->current() ) );
584 $users = User::findUsersByGroup( [
'baz',
'boom' ] );
585 $this->assertEquals( 1, iterator_count(
$users ) );
587 $this->assertTrue( $user->equals(
$users->current() ) );
598 'wgCookieSetOnAutoblock' =>
true,
599 'wgCookiePrefix' =>
'wmsitetitle',
606 $request1->getSession()->setUser( $user1tmp );
607 $expiryFiveHours =
wfTimestamp() + ( 5 * 60 * 60 );
608 $block =
new Block( [
609 'enableAutoblock' =>
true,
610 'expiry' =>
wfTimestamp( TS_MW, $expiryFiveHours ),
612 $block->setTarget( $user1tmp );
614 $user1 = User::newFromSession( $request1 );
615 $user1->mBlock = $block;
619 $this->assertTrue( $user1->isLoggedIn() );
620 $this->assertTrue( $user1->isBlocked() );
622 $this->assertTrue( $block->isAutoblocking() );
623 $this->assertGreaterThanOrEqual( 1, $block->getId() );
626 $cookies = $request1->response()->getCookies();
627 $this->assertArrayHasKey(
'wmsitetitleBlockID', $cookies );
628 $this->assertEquals( $expiryFiveHours, $cookies[
'wmsitetitleBlockID'][
'expire'] );
630 $this->assertEquals( $block->getId(), $cookieValue );
634 $request2->setCookie(
'BlockID', $block->getCookieValue() );
635 $user2 = User::newFromSession( $request2 );
637 $this->assertNotEquals( $user1->getId(), $user2->getId() );
638 $this->assertNotEquals( $user1->getToken(), $user2->getToken() );
639 $this->assertTrue( $user2->isAnon() );
640 $this->assertFalse( $user2->isLoggedIn() );
641 $this->assertTrue( $user2->isBlocked() );
642 $this->assertEquals(
true, $user2->getBlock()->isAutoblocking() );
645 $this->assertEquals( $block->getId(), $user2->getBlock()->getId() );
646 $this->assertEquals( $block->getExpiry(), $user2->getBlock()->getExpiry() );
651 $request3->getSession()->setUser( $user3tmp );
652 $request3->setCookie(
'BlockID', $block->getId() );
653 $user3 = User::newFromSession( $request3 );
655 $this->assertTrue( $user3->isLoggedIn() );
656 $this->assertTrue( $user3->isBlocked() );
657 $this->assertEquals(
true, $user3->getBlock()->isAutoblocking() );
670 'wgCookieSetOnAutoblock' =>
false,
671 'wgCookiePrefix' =>
'wm_no_cookies',
678 $request1->getSession()->setUser( $testUser );
679 $block =
new Block( [
'enableAutoblock' =>
true ] );
680 $block->setTarget( $testUser );
682 $user = User::newFromSession( $request1 );
683 $user->mBlock = $block;
687 $this->assertTrue( $user->isLoggedIn() );
688 $this->assertTrue( $user->isBlocked() );
690 $this->assertTrue( $block->isAutoblocking() );
691 $this->assertGreaterThanOrEqual( 1, $user->getBlockId() );
692 $this->assertGreaterThanOrEqual( $block->getId(), $user->getBlockId() );
693 $cookies = $request1->response()->getCookies();
694 $this->assertArrayNotHasKey(
'wm_no_cookiesBlockID', $cookies );
707 'wgCookieSetOnAutoblock' =>
true,
708 'wgCookiePrefix' =>
'wm_infinite_block',
714 $request1->getSession()->setUser( $user1Tmp );
715 $block =
new Block( [
'enableAutoblock' =>
true,
'expiry' =>
'infinity' ] );
716 $block->setTarget( $user1Tmp );
718 $user1 = User::newFromSession( $request1 );
719 $user1->mBlock = $block;
723 $this->assertTrue( $user1->isLoggedIn() );
724 $this->assertTrue( $user1->isBlocked() );
726 $this->assertTrue( $block->isAutoblocking() );
727 $this->assertGreaterThanOrEqual( 1, $user1->getBlockId() );
728 $cookies = $request1->response()->getCookies();
730 $this->assertArrayHasKey(
'wm_infinite_blockBlockID', $cookies );
735 $cookies[
'wm_infinite_blockBlockID'][
'expire'],
742 $block->mExpiry =
wfTimestamp( TS_MW, $newExpiry );
746 $request2->getSession()->setUser( $user2tmp );
747 $user2 = User::newFromSession( $request2 );
748 $user2->mBlock = $block;
750 $cookies = $request2->response()->getCookies();
751 $this->assertEquals(
wfTimestamp( TS_MW, $newExpiry ), $block->getExpiry() );
752 $this->assertEquals( $newExpiry, $cookies[
'wm_infinite_blockBlockID'][
'expire'] );
763 TestingAccessWrapper::newFromObject( $user )->mRequest =
$request;
764 $request->getSession()->setUser( $user );
766 $this->
setMwGlobals(
'wgSoftBlockRanges', [
'10.0.0.0/8' ] );
773 $this->assertNull(
$wgUser->getBlock() );
781 $this->assertInstanceOf( Block::class, $block );
782 $this->assertSame(
'wgSoftBlockRanges', $block->getSystemBlockType() );
789 $this->assertFalse(
$wgUser->isAnon(),
'sanity check' );
790 $this->assertNull(
$wgUser->getBlock() );
799 'wgCookieSetOnAutoblock' =>
true,
800 'wgCookiePrefix' =>
'wmsitetitle',
807 $request1->getSession()->setUser( $user1tmp );
808 $block =
new Block( [
'enableAutoblock' =>
true ] );
809 $block->setTarget( $user1tmp );
811 $user1 = User::newFromSession( $request1 );
812 $user1->mBlock = $block;
818 $request2->setCookie(
'BlockID', $block->getId() .
'!zzzzzzz' );
819 $user2 = User::newFromSession( $request2 );
821 $this->assertTrue( $user2->isAnon() );
822 $this->assertFalse( $user2->isLoggedIn() );
823 $this->assertFalse( $user2->isBlocked() );
836 'wgCookieSetOnAutoblock' =>
true,
837 'wgCookiePrefix' =>
'wmsitetitle',
838 'wgSecretKey' =>
null,
844 $request1->getSession()->setUser( $user1tmp );
845 $block =
new Block( [
'enableAutoblock' =>
true ] );
846 $block->setTarget( $user1tmp );
848 $user1 = User::newFromSession( $request1 );
849 $user1->mBlock = $block;
851 $this->assertTrue( $user1->isBlocked() );
856 $request2->setCookie(
'BlockID', $block->getId() );
857 $user2 = User::newFromSession( $request2 );
859 $this->assertNotEquals( $user1->getId(), $user2->getId() );
860 $this->assertNotEquals( $user1->getToken(), $user2->getToken() );
861 $this->assertTrue( $user2->isAnon() );
862 $this->assertFalse( $user2->isLoggedIn() );
863 $this->assertTrue( $user2->isBlocked() );
864 $this->assertEquals(
true, $user2->getBlock()->isAutoblocking() );
873 $user = User::newFromSession(
$request );
876 $this->assertTrue( $user->isPingLimitable() );
878 $this->
setMwGlobals(
'wgRateLimitsExcludedIPs', [
'1.2.3.4' ] );
879 $this->assertFalse( $user->isPingLimitable() );
881 $this->
setMwGlobals(
'wgRateLimitsExcludedIPs', [
'1.2.3.0/8' ] );
882 $this->assertFalse( $user->isPingLimitable() );
885 $noRateLimitUser = $this->getMockBuilder( User::class )->disableOriginalConstructor()
886 ->setMethods( [
'getIP',
'getRights' ] )->getMock();
887 $noRateLimitUser->expects( $this->
any() )->method(
'getIP' )->willReturn(
'1.2.3.4' );
888 $noRateLimitUser->expects( $this->
any() )->method(
'getRights' )->willReturn( [
'noratelimit' ] );
889 $this->assertFalse( $noRateLimitUser->isPingLimitable() );
894 [ 2, 2,
'newcomer' ],
895 [ 12, 3,
'newcomer' ],
896 [ 8, 5,
'newcomer' ],
897 [ 15, 10,
'learner' ],
898 [ 450, 20,
'learner' ],
899 [ 460, 33,
'learner' ],
900 [ 525, 28,
'learner' ],
901 [ 538, 33,
'experienced' ],
910 'wgLearnerEdits' => 10,
911 'wgLearnerMemberSince' => 4,
912 'wgExperiencedUserEdits' => 500,
913 'wgExperiencedUserMemberSince' => 30,
918 $data =
new stdClass();
920 $data->user_name =
'name';
921 $data->user_real_name =
'Real Name';
922 $data->user_touched = 1;
923 $data->user_token =
'token';
924 $data->user_email =
'a@a.a';
925 $data->user_email_authenticated =
null;
926 $data->user_email_token =
'token';
927 $data->user_email_token_expires =
null;
928 $data->user_editcount = $editCount;
929 $data->user_registration =
$db->
timestamp( time() - $memberSince * 86400 );
930 $user = User::newFromRow( $data );
932 $this->assertEquals( $expLevel, $user->getExperienceLevel() );
936 $user = User::newFromName(
'10.11.12.13',
false );
938 $this->assertFalse( $user->getExperienceLevel() );
943 [
'1.2.3.4',
'1.2.3.4' ],
944 [
'1.2.3.4',
'1.2.3.0/16' ],
956 $this->assertFalse( User::isLocallyBlockedProxy( $ip ) );
964 $this->assertTrue( User::isLocallyBlockedProxy( $ip ) );
969 'test' => $blockListEntry
972 $this->assertTrue( User::isLocallyBlockedProxy( $ip ) );
975 'IP addresses in the keys of $wgProxyList (found the following IP ' .
976 'addresses in keys: ' . $blockListEntry .
', please move them to values)'
981 $blockListEntry =>
'test'
984 $this->assertTrue( User::isLocallyBlockedProxy( $ip ) );
they could even be mouse clicks or menu items whatever suits your program You should also get your if any
$wgDefaultUserOptions
Settings added to this array will override the default globals for the user preferences used by anony...
$wgGroupPermissions
Permission keys given to users in each group.
$wgRevokePermissions
Permission keys revoked from users in each group.
wfGetDB( $db, $groups=[], $wiki=false)
Get a Database object.
wfTimestamp( $outputtype=TS_UNIX, $ts=0)
Get a timestamp string in one of various formats.
static getIdFromCookieValue( $cookieValue)
Get the stored ID from the 'BlockID' cookie.
static makeContent( $text, Title $title=null, $modelId=null, $format=null)
Convenience function for creating a Content object from a given textual representation.
WebRequest clone which takes values from a provided array.
static generateHex( $chars, $forceStrong=false)
Generate a run of (ideally) cryptographically random data and return it in hexadecimal string format.
static getMain()
Static methods.
testUserPermissions()
User::getRights.
testGetGroupsWithPermission( $expected, $right)
provideGetGroupsWithPermission User::getGroupsWithPermission
testExperienceLevelAnon()
testUserGetRightsHooks()
User::getRights.
testOptions()
Test changing user options.
testGetCanonicalName( $name, $expectedArray)
User::getCanonicalName() provideGetCanonicalName.
testAutoblockCookies()
When a user is autoblocked a cookie is set with which to track them in case they log out and change I...
testAutoblockCookieInfiniteExpiry()
When a user is autoblocked and a cookie is set to track them, the expiry time of the cookie should ma...
testAutoblockCookieInauthentic()
Test that a modified BlockID cookie doesn't actually load the relevant block (T152951).
testExperienceLevel( $editCount, $memberSince, $expLevel)
provideExperienceLevel
static provideGetGroupsWithPermission()
testIsValidUserName( $username, $result, $message)
provideUserNames User::isValidUserName
testIsIP( $value, $result, $message)
provideIPs User::isIP
testGetEditCount()
Test User::editCount medium User::getEditCount.
testAutoblockCookieNoSecretKey()
The BlockID cookie is normally verified with a HMAC, but not if wgSecretKey is not set.
static provideGetCanonicalName()
testAnonOptions()
T39963 Make sure defaults are loaded when setOption is called.
testIncEditCount()
Test User::editCount medium User::incEditCount.
testGetEditCountForAnons()
Test User::editCount medium User::getEditCount.
testRevokePermissions()
User::getGroupPermissions.
static provideIsLocallBlockedProxy()
testEquals()
User::equals.
testCheckPasswordValidity()
Test password validity checks.
testIsLocallyBlockedProxy( $ip, $blockListEntry)
provideIsLocallBlockedProxy User::isLocallyBlockedProxy
testAllRightsWithMessage()
Test, if for all rights a right- message exist, which is used on Special:ListGroupRights as help text...
testCheckAndSetTouched()
User::checkAndSetTouched.
testLoggedIn()
User::isLoggedIn User::isAnon.
testAutoblockCookiesDisabled()
Make sure that no cookie is set to track autoblocked users when $wgCookieSetOnAutoblock is false.
testGroupPermissions()
User::getGroupPermissions.
testFindUsersByGroup()
User::findUsersByGroup.
static provideUserNames()
The User object encapsulates all of the user-specific settings (user_id, name, rights,...
setOption( $oname, $val)
Set the given option for a user.
incEditCount()
Deferred version of incEditCountImmediate()
The WebRequest class encapsulates getting at data passed in the URL or via a POSTed form stripping il...
static factory(Title $title)
Create a WikiPage object of the appropriate class for the given title.
do that in ParserLimitReportFormat instead use this to modify the parameters of the image all existing parser cache entries will be invalid To avoid you ll need to handle that somehow(e.g. with the RejectParserCacheValue hook) because MediaWiki won 't do it for you. & $defaults also a ContextSource after deleting those rows but within the same transaction you ll probably need to make sure the header is varied on $request
this hook is for auditing only or null if authentication failed before getting that far $username
processing should stop and the error should be shown to the user * false