aboutsummaryrefslogtreecommitdiffstats
path: root/tests/phpunit/includes/user
Commit message (Collapse)AuthorAgeFilesLines
* Namespace all remaining files in includes/loggingJames D. Forrester2025-03-191-1/+1
| | | | | Bug: T353458 Change-Id: Ibe1810f1c71316a9124e1dc6ae405097dafd5267
* Merge "Remove inline @var docs that aren't needed"jenkins-bot2025-03-141-2/+0
|\
| * Remove inline @var docs that aren't neededthiemowmde2024-11-051-2/+0
| | | | | | | | | | | | | | Not needed (any more) because the code already contains enough @return docs and such. Change-Id: If461fa035d2c646878540565b3087a74c6628552
* | BotPasswordTest: Add a few more test cases provideCanonicalizeLoginDataReedy2025-03-131-0/+4
| | | | | | | | | | Bug: T388255 Change-Id: I6e1a6fa8e75f519ccbf3c2bb4de7334f620e2a8e
* | user: Add filtered versions of CentralIdLookup::lookupUserNamesTim Starling2025-03-062-13/+35
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Add a batch version of CentralIdLookup::isOwned(), to support the linked bug. * Add test. * Fix error in LocalIdLookupTest::provideIsAttachedShared() which failed to provide the shared case due to an incorrect loop bound. This test has been non-functional since it was introduced in 2015. * Fix error in LocalIdLookupTest::newLookup() which failed to override the config. Bug: T386584 Depends-On: Ie63ed1f14c9ba4f9cefcceef05d5585a6676f111 Depends-On: I83716f7930bd0d2de4761cc5b04d9d3ff4172da2 Change-Id: I99dd733547f46e635c2f363166ce111e76e06a5e
* | block: DatabaseBlock constructor caller migrationTim Starling2025-03-043-43/+36
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There's about 100 callers of the DatabaseBlock constructor in core tests, most of them passing an address parameter which needs access to the global service container to parse. Many are passing the constructed object straight to DatabaseBlockStore::insertBlock(). So add insertWithParams() for their convenience, which has some handy shortcut parameters, has service access, and throws on failure. The calling code tends to be shorter than before. For unit tests trying to construct DatabaseBlock objects without a service container, direct construction of BlockTarget subclasses is warranted. Add a default to the $wikiId parameters for their convenience. MockBlockManager had its own 'target' parameter, mixed in with block options, carrying its own special idea of a target, which conflicted with DatabaseBlock's new 'target' parameter. Harmonise the parameters and fix the callers. Bug: T382106 Bug: T385966 Change-Id: I78b45a6003b62962211379c36da5587081f90f00
* | Disallow setting passwords for temporary accountsDreamy Jazz2025-02-191-0/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Why: * Temporary accounts are automatically created when a user makes an edit, and therefore do not have a password set by the user who created the temporary account * Currently, there is no limitation that prevents a password being set for a temporary account. ** This means that the createAndPromote.php maintenance script can set a password for a temporary account or create a new temporary account with a specified password. * A temporary account having a password allows a user to login to the account, even after the account has expired. ** This should not be allowed, and as such we should reject any attempts to set or change the password for a temporary account. What: * Update User::checkPasswordValidity to reject any password provided if the user matches the temporary account name format. * Add tests for this. Bug: T386775 Change-Id: I5354d240678fca9dbf3ed699370cf1a4df96b2f9
* | rdbms: remove MWLBFactory::applyGlobalState deferred update logicAaron Schulz2024-12-192-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Make the Maintenance transaction wrapper methods directly invoke DeferredUpdates::tryOpportunisticExecute() and flush stats data. This includes the following methods: * Maintenance::commitTransaction() * Maintenance::commitTransactionRound() * Maintenance::waitForReplication() Add explicit DeferredUpdates::tryOpportunisticExecute() calls to integration tests as needed. Deprecate the now-unused IDatabase::setTransactionListener() and ILBFactory::setWaitForReplicationListener(). Bug: T373057 Change-Id: I06488d1826ee97de460cf52117b5d691fa5945ad
* | Merge "Use real type hints for services etc. in includes/auth/, session/, user/"jenkins-bot2024-11-092-6/+2
|\ \ | |/ |/|
| * Use real type hints for services etc. in includes/auth/, session/, user/Bartosz Dziewoński2024-11-022-6/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Mostly used find-and-replace: Find: /\*[\*\s]+@var (I?[A-Z](\w+)(?:Interface)?)[\s\*]+/\s*(private|protected|public) (\$[a-z]\w+;\n)((?=\s*/\*[\*\s]+@var (I?[A-Z](\w+)(?:Interface)?))\n|) Replace with: \3 \1 \4 More could be done, but to keep this patch reasonably sized, I only changed the most obvious and unambiguously correct cases. In some cases, I also removed redundant doc comments on the constructor, and re-ordered the properties to match the constructor. Bonus: Fix some todos in AuthManagerTest. Change-Id: Ife5313b821cf537984f6de364bfe1d9b4b992a07
* | user: Allow excluding autopromotions into select groups from RCMáté Szabó2024-10-311-0/+77
|/ | | | | | | | | | | | | | | | | | | | | Why: - The config variable $wgAutopromoteOnceLogInRC controls whether autopromotions show up in recent changes, but offers no granular controls beyond that. - In T377829, stewards have expressed interest in excluding certain spammy autopromote groups from recent changes. What: - Introduce and use a new config variable $wgAutopromoteOnceRCExcludedGroups that can be used to define a denylist of groups. Autopromotions into these groups will never result in an RC entry, as long as they were the only new groups the user was autopromoted into. Bug: T377829 Change-Id: Ia4942b09a5162749f24c8f674429fbf3f0459a0b
* Use ++ and -- rather than += 1 and -= 1Reedy2024-10-171-1/+1
| | | | Change-Id: I27b9a19ab952ede1267921bd042af0fe1c89e228
* Use explicit nullable type on parameter argumentsUmherirrender2024-10-162-4/+4
| | | | | | | | | | | Implicitly marking parameter $... as nullable is deprecated in php8.4, the explicit nullable type must be used instead Created with autofix from Ide15839e98a6229c22584d1c1c88c690982e1d7a Break one long line in SpecialPage.php Bug: T376276 Change-Id: I807257b2ba1ab2744ab74d9572c9c3d3ac2a968e
* Merge "user: Add recursion guard to APCOND_BLOCKED check in UserGroupManager"jenkins-bot2024-10-091-0/+72
|\
| * user: Add recursion guard to APCOND_BLOCKED check in UserGroupManagerVoidwalker2024-10-091-0/+72
| | | | | | | | | | | | | | | | | | | | This is to prevent infinite recursion when checking APCOND_BLOCKED due to potentially repeated calls to user->getBlock. UserGroupManager::checkCondition now throws a LogicException when recursive behavior is detected during the APCOND_BLOCKED check. Bug: T349608 Change-Id: Ia55a4d27be0f583c3bc826661579cbb4e7c47881
* | Add namespace to IDBAccessObject and DBAccessObjectUtilsJames D. Forrester2024-09-273-1/+3
| | | | | | | | | | Bug: T353458 Change-Id: I23cf7991f8792d4d000d1780463d8ce76dc0aee0
* | Add SpreadAnyEditBlock hookDreamy Jazz2024-09-241-0/+56
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Why: * A hook is needed which is called when User::spreadAnyEditBlock is called, so that extensions which provide alternative blocking mechanisims (such as the GlobalBlocking extension) can spread their blocks when local blocks are spread. What: * Add SpreadAnyEditBlockHook which is called from User ::spreadAnyEditBlock when it is called except when the user is not registered. ** The hook is called even if the user is not locally blocked * The return value of User::spreadAnyEditBlock is modified to return true if either a local block or alternative blocking mechanism spread blocks. * Update UserTest to test this new behaviour. Bug: T374857 Change-Id: Id302a6362d6177c89da9cdf4e677b3822ecb85f1
* | Merge "Allow extensions to send password resets without a local user/email"jenkins-bot2024-09-191-0/+7
|\ \
| * | Allow extensions to send password resets without a local user/emailBartosz Dziewoński2024-09-161-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Move the checks for the existence of the user and the presence of their email address before the 'SpecialPasswordResetOnSubmit' hook, instead of after. This allows extensions to make their own decisions about whether a user exists or has email. This also means that extensions must now check the 'requireemail' preference when only the username is provided. They already had to check it when only the email was provided, so this seems more like a bug fix. To allow them to check this logic, if both the username and email were provided by the user, provide both of them to the hook. Bug: T151012 Change-Id: I6baf2c5194f981803198729f59e1e83d5644383a
* | | tests: Add missing documentation to class propertiesUmherirrender2024-09-182-0/+3
|/ / | | | | | | | | | | | | | | | | | | Add doc-typehints to class properties found by the PropertyDocumentation sniff to improve the documentation. Once the sniff is enabled it avoids that new code is missing type declarations. This is focused on documentation and does not change code. Change-Id: Ifc27750207edc09e94af030d882b6f1a5369cf98
* | PasswordReset: remove $wgAllowRequiringEmailForResets feature flagMusikAnimal2024-08-281-22/+21
| | | | | | | | | | | | | | | | | | Update a few tests that relied on the feature flag to ignore the 'requireemail' preference on "User1" to instead use "User2", who doesn't have the preference set. Bug: T242406 Change-Id: I996d3996272d704a071d1d2094c3568247b80f98
* | Merge "PasswordReset: Code quality improvements"jenkins-bot2024-08-231-3/+7
|\ \
| * | PasswordReset: Code quality improvementsBartosz Dziewoński2024-08-081-3/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Treat the username/email as provided when it's a falsy string ('0'). Refactor away some redundant checks and variables. Only construct User objects when needed for the hook. Documentation and code style tweaks. Change-Id: I499d73dacfb48a95291dcfa0405e52788a0251f4
* | | Add namespace to WikitextContentEbrahim Byagowi2024-08-061-0/+1
|/ / | | | | | | | | | | | | It adds MediaWiki\Content namespace to WikitextContent and two classes related. Change-Id: Ib74e4c5b3edac6aa0e35d3b2093ce1d0b794cb6d
* / Restore password reset invalid email messageBartosz Dziewoński2024-07-301-4/+4
|/ | | | | | | | | | | | | | This mostly reverts commit 28ad29ea0ff9480c97d4d5746f5b2526dfb1a3f5. Checking the validity of the provided email doesn't reveal any information about any users, and it could help catch genuine mistakes, e.g. if someone inputs the username in the email field. Previously if an invalid email was provided, we showed a success message that is an obvious lie (saying we sent an email to something that isn't an email address). Change-Id: Idec437b29b22e5b1e5aaff3846632fbc413a3dcb
* Merge "Use MainConfigNames constants in tests where possible"jenkins-bot2024-07-112-48/+43
|\
| * Use MainConfigNames constants in tests where possiblethiemowmde2024-07-102-48/+43
| | | | | | | | | | | | | | I believe this makes the code less brittle, and also makes it a bit more obvious what these strings are meant to represent. Change-Id: Ia39b5c80af4b495931d0a68fd091b783645dd709
* | Add namespace to the root classes of ObjectCacheEbrahim Byagowi2024-07-101-0/+1
|/ | | | | | | | | And deprecated aliases for the the no namespaced classes. ReplicatedBagOStuff that already is deprecated isn't moved. Bug: T353458 Change-Id: Ie01962517e5b53e59b9721e9996d4f1ea95abb51
* Tests: Replace "db" with getDb methodWandji692024-06-303-10/+10
| | | | | Bug: T316841 Change-Id: Ie6b08125b76d2d4b7a30375357dcb90aaa0189c1
* Merge "UserTest#testNewFromAnyId: Disable temp accounts"jenkins-bot2024-06-271-0/+1
|\
| * UserTest#testNewFromAnyId: Disable temp accountsKosta Harlan2024-06-271-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Why: - The test has a mix of IP and named accounts in its tests, which won't work when temp accounts are enabled What: - Disable temp accounts feature for the test Bug: T365669 Change-Id: I94ee06aea6fa9f891f0b40417056ae9c1d21126a
* | Merge "UserTest#testActorId: Disable temp accounts for some cases"jenkins-bot2024-06-271-0/+2
|\|
| * UserTest#testActorId: Disable temp accounts for some casesKosta Harlan2024-06-271-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Why: - Two test cases check for IP editing functionality, which won't work with temp accounts enabled What: - Disable temp accounts for those two test cases Bug: T365669 Change-Id: I445b547da8b5b224984c15a1a79ef38ad8dd2dd1
* | UserEditTrackerTest#testGetEditTimestamp_anon: Disable temp accountsKosta Harlan2024-06-271-0/+4
|/ | | | | | | | | | | | | Why: - This test checks for anonymous editing functionality specifically What: - Disable temp accounts for this test Bug: T365669 Change-Id: Id665af3549add78e54be790209fbc890d78e5b74
* User: Reset default value for isTemp in loadDefaultsKosta Harlan2024-06-251-0/+12
| | | | | | | | | | | | | | | | Why: - isTemp is not reset after logging out as a temp user because the isTemp property is cached in-process, and not reset in User::loadDefaults() What: - When creating a new User, reset the isTemp field to null. The next invocation of isTemp() will update the value of the isTemp field. Bug: T345936 Change-Id: Ibff540c4d92fe53ec6d3af3488a12f7446dfdfbe
* Replace db with getDb for TestsWandji692024-06-234-14/+14
| | | | | Bug: T316841 Change-Id: I29e535e8ee9b5641a4546d53b98cd5060d39681d
* Remove the 'named' user group, which is no longer usedThalia2024-06-201-11/+11
| | | | | | | | | | | | | | | | | | | Why: * When temporary accounts were first implemented, temporary users were added to the 'user' group, and named users were added to a 'named' user group, to differentiate them from temporary users. * Since T340457, temporary users were no longer added to the 'user' group. This means that the 'named' group is no longer needed. What: * Stop adding users to a 'named' user group in UserGroupManager. * Remove special handling for the 'named' group in PermissionManager and tests. Bug: T355741 Change-Id: I06bd5d7150203bbcb0806868fe829a438af486ba
* Merge "tests: Use namespaced classes (1)"jenkins-bot2024-06-141-0/+1
|\
| * tests: Use namespaced classes (1)Umherirrender2024-06-141-0/+1
| | | | | | | | | | | | | | Changes to the use statements done automatically via script Addition of missing use statement done manually Change-Id: Iae45fa269363be8ee05c598ea6926514ce817762
* | tests: Use namespaced classes (@covers)Umherirrender2024-06-141-2/+2
|/ | | | | | Some fixes done via codesniffer fix (Ibd0f48e14e) Change-Id: I0404ceca7c5abe8d32ef9a8fce404c7b89ffbaae
* Merge "Use constants provided by MainConfigNames for config names"jenkins-bot2024-05-191-1/+1
|\
| * Use constants provided by MainConfigNames for config namesFunc2024-05-181-1/+1
| | | | | | | | Change-Id: I2f29ea8227da64b79b70fcce3decb6e34ea8da5b
* | Namespace includes/passwordReedy2024-05-182-6/+7
|/ | | | | Bug: T353458 Change-Id: I1a701b5b7ff65356692abb0efde9a2207b6135b6
* Tests: remove a bunch of DummyServicesTrait-related commentsDannyS7122024-05-101-1/+0
| | | | | | Not sure why I added these, it should be clear from the method names Change-Id: Ie49881e6f31fad52bb65b0d2ac3e9379dbb7bfc5
* StatusValue: Document and deprecate broken ways to search/replace messagesBartosz Dziewoński2024-05-031-8/+5
| | | | | | | | | | | | | StatusValue::replaceMessage() doesn't really work if given a MessageSpecifier, and doesn't work at all if given a MessageValue. StatusValue::hasMessage() and ::hasMessagesExcept() ignore the message parameters when searching if given a MessageSpecifier or MessageValue. Therefore, deprecate passing anything other than strings representing message keys to these methods. Change-Id: Icb4effc6c5319c12ba4ebeab447a0cef54f8e255
* Merge "User: Hard-deprecate some methods with no uses in WMF production"jenkins-bot2024-05-031-0/+1
|\
| * User: Hard-deprecate some methods with no uses in WMF productionTaavi Väänänen2024-05-031-0/+1
| | | | | | | | Change-Id: I13fe4d9a35bac0e51960722b1436783a22fef745
* | User: Drop several hard-deprecated methodsTaavi Väänänen2024-05-031-119/+0
|/ | | | | Bug: T277511 Change-Id: Ifea9eb11884ff52b22631b309ff0489332e741ba
* tests: Migrate to IReadableDatabase::newSelectQueryBuilderUmherirrender2024-05-021-16/+12
| | | | | Bug: T344971 Change-Id: Ic6940fcc06225069a0c3618c22a0e62942e5dd88
* Merge "tests: Migrate to IDatabase::newInsertQueryBuilder"jenkins-bot2024-04-143-25/+35
|\