aboutsummaryrefslogtreecommitdiffstats
path: root/tests/phpunit/integration
Commit message (Collapse)AuthorAgeFilesLines
* htmlform: Drop HTMLForm::*Text and FormSpecialPage::*Text functions, ↵Umherirrender2025-03-261-22/+2
| | | | | | | | | | | | | | | | | | | | | | | deprecated in 1.38 The following functions were removed: - FormSpecialPage::preText - FormSpecialPage::postText - HTMLForm::getPreText - HTMLForm::setPreText - HTMLForm::addPreText - HTMLForm::getPostText - HTMLForm::setPostText - HTMLForm::addPostText - HTMLForm::getHeaderText - HTMLForm::setHeaderText - HTMLForm::addHeaderText - HTMLForm::getFooterText - HTMLForm::setFooterText - HTMLForm::addFooterText Bug: T325474 Change-Id: Id8a05542fc56db52f3a5141a1b2125c1a602cf3c
* Merge "DomainEvents: Model page state before/after"jenkins-bot2025-03-251-7/+11
|\
| * DomainEvents: Model page state before/afterdaniel2025-03-251-7/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Why: - PageStateEvent models a change in page state, so it should provide access to the state before and after What: - add getPageRecordBefore() and getPageRecordAfter() to PageStateEvent - Move getPage() from PageStateEvent down to PageRevisionUpdatedEvent. - Add getPageId() to PageStateEvent. - Add getDeletedPage to PageDeletedEvent Bug: T388588 Depends-On: I76b09f2275a74d02e5701de2082d6b256d6b3b78 Change-Id: I94c52c0314e5dbe9adf82aab732f2e54ca42f686
* | Namespace all remaining files in includes/skinJames D. Forrester2025-03-251-2/+2
| | | | | | | | | | Bug: T353458 Change-Id: I3e829e35c93bcaae75e401b1801bddf93c0b416c
* | Namespace all remaining files in includes/changetagsJames D. Forrester2025-03-252-2/+2
| | | | | | | | | | Bug: T353458 Change-Id: I3cf44dfe5425f2efb8409c83571c427447b053af
* | Namespace all remaining files in includes/exceptionJames D. Forrester2025-03-252-4/+4
|/ | | | | | | | | In MediaWiki/Exception, to follow PSR-4 per plural vs. singular (this can be changed later if people really care). Also, move the couple of exceptions in here that were already namespaced in the MW-top-level into the new space. Bug: T353458 Change-Id: I12ed850ae99effb699a6d7ada173f54e72f0570e
* Merge "REST: Make OpenAPI spec info strings translatable"jenkins-bot2025-03-241-2/+2
|\
| * REST: Make OpenAPI spec info strings translatablebpirkle2025-03-211-2/+2
| | | | | | | | | | | | | | | | | | OpenAPI specs include an "info" section that includes strings such as "title" and "description" that are intended to be human-readable. Make all such strings translatable. Bug: T385855 Change-Id: I15285be6d196c0e7fd7e922f23058d7c09b6b31a
* | Merge "rdbms: Fix disabled PostgreSQL test"jenkins-bot2025-03-241-94/+51
|\ \
| * | rdbms: Fix disabled PostgreSQL testTim Starling2025-03-241-94/+51
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | And clean up after version requirement was increased to PG 10. * In DatabasePostgres::indexInfo() iterate over all core schemas instead of just querying the current schema. I broke this after the test for it was disabled. * In ApiQueryAllPages, remove the PG 9 branches and simplify the comments. * In DatabasePostgresTest, fix the skip conditions for the introduction of DBConnRef. * Remove tests for "old insert ignore", and "old insert select", which no longer exist. * In testFieldAndIndexInfo(), create a prefixed table name since that's easier and safer than trying to switch domains just for this test. Bug: T259084 Change-Id: Ifab7c045c40d039e542e2df19037b342d4984472
* | | Merge "rdbms: Require SQLite 3.24+"jenkins-bot2025-03-211-3/+0
|\ \ \
| * | | rdbms: Require SQLite 3.24+Tim Starling2025-03-181-3/+0
| |/ / | | | | | | | | | | | | | | | | | | | | | Require SQLite 3.24+, released June 2018. Minimum distro releases: Debian 10 (buster), Ubuntu 20.04, Fedora 29. Bug: T389028 Change-Id: I1f548ee162921fa8398740e4b0528703c84bcaa3
* | | Merge "notifications: Introduce Notification Middleware and ↵jenkins-bot2025-03-211-0/+74
|\ \ \ | | | | | | | | | | | | NotificationEnvelope"
| * | | notifications: Introduce Notification Middleware and NotificationEnvelopePiotr Miazga2025-03-211-0/+74
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | To allow ourselves esier processing/modifying Notifications lets introduce an idea of NotificationsEnvelope which represents a Notification being sent and list of recipients. The middleware approach will allow us to modify the Notification behaviour by letting extensions to inject/modify the Notifications. Each Middleware will retrieve a list of Envelopes MediaWiki wants to send. Middlewares should iterate over envelopes and decide if those want to add/remove/replace Notifications and/or Recipients. Bug: T387996 Change-Id: Ib3ee35c75b2f4dcfdc516b9259a852dc73c4a778
* | | | Namespace all remaining files in includes/jobqueueJames D. Forrester2025-03-203-7/+7
| | | | | | | | | | | | | | | | | | | | Bug: T353458 Change-Id: I95690a312e356c45dbeed607d32fb0e4626690cf
* | | | Namespace all remaining files in includes/loggingJames D. Forrester2025-03-192-4/+4
| | | | | | | | | | | | | | | | | | | | Bug: T353458 Change-Id: Ibe1810f1c71316a9124e1dc6ae405097dafd5267
* | | | Namespace all remaining files in includes/actionsJames D. Forrester2025-03-191-2/+2
| |_|/ |/| | | | | | | | | | | Bug: T353458 Change-Id: Id3ca24e22877e544b707a8a527a58e00cc1bc247
* | | Namespace all remaining files in includes/filerepoJames D. Forrester2025-03-192-2/+2
| | | | | | | | | | | | | | | Bug: T353458 Change-Id: I35864ad9bd48701703c51367d62f8ebde963c52d
* | | Merge "DatabaseBlockStore: bring bl_timestamp to current when updating blocks"jenkins-bot2025-03-191-0/+3
|\ \ \
| * | | DatabaseBlockStore: bring bl_timestamp to current when updating blocksMusikAnimal2025-03-191-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is because bl_timestamp is compared against bl_expiry when generating relative timestamps in ApiQueryBlocks and BlockLogFormatter (see Ie88ca47053b). Bug: T389275 Change-Id: I3b1adc7095a317785c7d34694a017c8a802406c8
* | | | Merge "Add regression test for null rollback"jenkins-bot2025-03-191-5/+48
|\ \ \ \ | |/ / / |/| | |
| * | | Add regression test for null rollbackMatěj Suchánek2025-03-151-5/+48
| | | | | | | | | | | | | | | | | | | | | | | | Follow up to I7bc38f07d1edea71e2dcd62781ec1c7f1fb0d261. Change-Id: I4317f62088fb002583cff03266997ae619a92266
* | | | Namespace all remaining files in includes/pageJames D. Forrester2025-03-181-1/+1
| | | | | | | | | | | | | | | | | | | | Bug: T353458 Change-Id: I7a9c74f2106655d41ae029742090253f541bd4a6
* | | | Merge "DomainEvents: Rename getOldRevision and getNewRevision"jenkins-bot2025-03-171-1/+1
|\ \ \ \ | |_|_|/ |/| | |
| * | | DomainEvents: Rename getOldRevision and getNewRevisiondaniel2025-03-151-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Why: - Use consistent naming scheme based on "before" and "after" to represent the change. What: - rename getOldRevision to getLatestRevisionBefore - rename getNewRevision to getLatestRevisionAfter Bug: T388588 Change-Id: I30078f606f457981987d95def5b2aaae181f0690
* | | | Fix expensive computations before cache hit and add additional caching to ↵Dylan F2025-03-161-1/+2
|/ / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | DefaultOptionsLookup * Moved getCacheKey to UserOptionsLookup * Added caching to DefaultOptionsLookup after conditional options * Move expensive getDefaultOptions to after cache miss Bug: T386883 Change-Id: I307e1d30e84396b56d919993aef4d411ecae8ea1
* | | Merge "DomainEvents: Rename PageEvent and PageUpdatedEvent"jenkins-bot2025-03-142-13/+13
|\ \ \ | |/ / |/| |
| * | DomainEvents: Rename PageEvent and PageUpdatedEventdaniel2025-03-112-13/+13
| |/ | | | | | | | | | | | | | | | | | | | | | | Why: - clarify naming after modeling discussions What: - Rename PageEvent to PageStateEvent - Rename PageUpdatedEvent to PageRevisionUpdatedEvent. Bug: T388588 Change-Id: I987c93a443d364782e692e2cf71b878ccbc5a2fa
* | Merge "tests: Streamline a few overcomplicated if-else in test code"jenkins-bot2025-03-111-5/+1
|\ \ | |/ |/|
| * tests: Streamline a few overcomplicated if-else in test codethiemowmde2025-03-111-5/+1
| | | | | | | | | | | | | | | | I believe the code is quite a bit more readable like this. There is less indirection and less duplication. The tests still do the same as before. Change-Id: I501ccee89b37e2338bc07af3024a75f0e45e05b3
* | Merge "DeletePage: emit PageDeletedEvent"jenkins-bot2025-03-101-5/+72
|\ \
| * | DeletePage: emit PageDeletedEventdaniel2025-03-101-5/+72
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Why: - We want to replace the PageDeletionComplete hook with an event - We want to validate our design for the hierarchical event type system and the modeling of page events. What: - Introduce PageDeletedEvent - Make DeletePage emit PageDeletedEvent - Move update triggers from DeletePage into ingress objects: - search index - message cache - module cache Bug: T379932 Change-Id: I01490fbaf33118eba109aa91908783117ba5aa20
* | | REST page metadata endpoints: handle supressed data gracefullydaniel2025-03-101-0/+101
| |/ |/| | | | | | | | | | | | | | | | | | | | | | | | | Why: - Revision meta-data output was failingfor revisions with suppressed user or comment What: - Handle suppressed user and comment gracefully - add regression test Bug: T386368 Bug: T387397 Change-Id: Ic6d3fc89d24030f5c3fd422637816de9976fc709
* | Merge "user: Allow gender to be a global preference"jenkins-bot2025-03-083-1/+33
|\ \
| * | user: Allow gender to be a global preferenceTim Starling2025-03-063-1/+33
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | GenderCache gets the "gender" user preference directly out of the core database. Thus it does not respect global preferences. So: * Add UserOptionsLookup::getOptionBatchForUserNames(), which gets a single user preference for a set of named users. * Add UserOptionsStore::fetchBatchForUserNames() as a backend. This is a new interface method so is a breaking change. * Have GenderCache call the new interface. The no-database case in ServiceWiring is apparently no longer reachable from the installer due to my previous patch which split MediaWikiTitleCodec. Performance generally degrades from one query to three. For change lists and user page namespace redirects, it shouldn't be a problem, but for the {{GENDER}} parser function there may be a user-visible performance degradation. Bug: T386584 Depends-On: Id02489a597f96cd1cd6db08e16b3624542fdf1f7 Change-Id: I9646b5422afce356e9a1dceeb09d8d4e286dc65e
* / PageUpdatedEvent: Model revert causesdaniel2025-03-072-57/+260
|/ | | | | | | | | | | | | | | | Why: - Rollback and undo should not use the "edit" cause, since they are triggered by a dedicated user action. What: - Introduce constants for rollback and undo into PageUpdateCauses. - Set update cause in McrUndoAction, EditPage, WikiPage, and Rollbackpage. - Add test cases asserting the properties of the PageUpdatedEvent for manual reverts, undos, and rollbacks. Bug: T378936 Change-Id: If3174732846795e322ddd61257459395eb10e73e
* block: DatabaseBlock constructor caller migrationTim Starling2025-03-044-60/+51
| | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Split MediaWikiTitleCodecTim Starling2025-03-033-11/+8
| | | | | | | | | | | | | | | | | | | | | | | | For the linked bug, I would really like GenderCache to use UserOptionsManager. But all user-related services need UserNameUtils which depends on TitleParser, and TitleFormatter needs GenderCache to correctly format NS_USER titles. Having TitleFormatter and TitleParser together in a single class creates an intractable dependency loop. So, split MediaWikiTitleCodec. On Daniel's advice I converted the existing TitleParser and TitleFormatter interfaces to classes. The code was always structured to allow this. Extensions require surprisingly few updates. MediaWikiTitleCodec remains only for its deprecated static methods. The implementations were split cleanly with no need for shared code. The tests did have a little bit of shared code, for round-trip testing, so I added a shared test base class for that. Bug: T386584 Depends-On: Ibf307e953b666d8923bc96a507907421558da378 Depends-On: I47e83e95727e6830500e9af7cff92e7d3f91167e Depends-On: Id9c045864a9dc3c640a896e6b34f516c7e42b050 Change-Id: I3dcce6639ed01c7611a663671c872cec775bdaa2
* Merge "RateLimiter: Fix peek mode"jenkins-bot2025-03-011-0/+30
|\
| * RateLimiter: Fix peek modedaniel2025-03-011-0/+30
| | | | | | | | | | | | | | | | | | | | | | | | Why: - Setting the increment to 0 should check the limit without bumping it. - This was apparently broken by If3e66491306f22650. What: - Use LimitBatch::peek if the increment amount is 0 Bug: T381033 Change-Id: Ife76a1976a2063f051f00302e5adaebd701e6367
* | tests: Fix MockAuthorityTrait to mutate $status if givenBartosz Dziewoński2025-02-281-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Since f42320b1093de029e238542c8bfe979c589e0775 (2023), several methods of the Authority interface accept an optional $status parameter, and mutate it to add relevant error messages and other information. Several methods were also added. MockAuthorityTrait was never updated to match the changes. Add the optional parameters and the new methods. This fixes incorrect expected values in RollbackPageTest - the real RollbackPage code depends on the $status having an error message if the action is not authorized. Also fix calling $permissionCallback to always use consistent argument types. Previously it was sometimes called with arguments like `$permissionCallback(string, ?PermissionStatus)`, and sometimes `$permissionCallback(string, PageIdentity, ?PermissionStatus)`, depending on which Authority method were used by the code under test. These changes may result in test failures in extensions. I will fix them if we find any. Change-Id: I95ef4219cc7b45d20f784dab233450467551334d
* | Merge "linker: Render expired temporary account names differently"jenkins-bot2025-02-251-4/+94
|\ \
| * | linker: Render expired temporary account names differentlyMáté Szabó2025-02-201-4/+94
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Why: - We would like to make the user links associated with expired temporary accounts visually distinguishable from non-expired ones using strikethrough styling and an information tooltip. - The designs call for using Codex tooltips for the latter. Using the Vue directive for this would require us to take a dependency on Codex and Vue for every page that renders user links, and render a small Vue.js app for each expired temporary user link, which does not seem practical. - We can, however, use Codex styles and implement our own simple tooltip functionality without taking on unnecessary dependencies. - This requires adding a new RL module to every page that uses userLink(), so we should update userLink() to do this for us instead of having to update every core and extension page that needs this. What: - Add a strikethrough to expired temporary account links as per the design specification. - Render a tooltip, hidden by default, for expired temporary account links that is styled using Codex styles. - Implement a simple jQuery tooltip handler for expired temporary account links. - Avoid caching expired temporary account link in UserLinkRenderer to ensure each of them receives a unique ID. - Add required ResourceLoader modules directly to the output in userLink(). Bug: T358469 Change-Id: I4f70ff15becbc4991c4f1b0307a14d5354c79dc1
* | | Merge "LinkBatch: Introduce addUser() helper"jenkins-bot2025-02-251-13/+1
|\| |
| * | LinkBatch: Introduce addUser() helperMáté Szabó2025-02-201-13/+1
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Why: - After I4f70ff15becbc4991c4f1b0307a14d5354c79dc1, it will become necessary to prefetch the expiration status of temporary accounts when rendering user links via UserLinkRenderer for a large list of users. - We would ideally like to accomplish this without requiring every user of UserLinkRenderer to take a direct dependency on TempUserDetailsLookup, which exposes this functionality. - Since most users of UserLinkRenderer / Linker::userLink() already use LinkBatch to prefetch page existence for the user and user talk pages that UserLinkRenderer will link to, encapsulating the TempUserDetailsLookup interaction within LinkBatch seems like a decent middle ground. What: - Add LinkBatch::addUser(), which takes a UserIdentity and adds its user and user talk pages to the batch while also triggering a batch lookup of expiration status for users added this way when execute() is called. Bug: T358469 Change-Id: Ic837961296cc4bf166dde79c7f073cc50ce925da
* / user: Add UserOptionsManager::GLOBAL_CREATETim Starling2025-02-242-28/+100
|/ | | | | | | | | Provide an interface allowing extensions to add global preferences. Add test for all the $global values. Bug: T386592 Change-Id: Id982656e228efaa97068b90f5137a0495c86fae5
* user: Implement batch user registration lookupsMáté Szabó2025-02-192-31/+48
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Why: - The TSP team would like to change the way expired temporary account user links are displayed, which requires an efficient way to fetch their registration timestamps. - On WMF wikis, which use CentralAuth, this requires fetching the first (i.e. global) registration timestamp of the account, rather than the naïve approach of using the registration timestamp from the local user table. - MediaWiki provides the UserRegistrationLookup facade to transparently fetch the earliest registration timestamp for a single user, but offers no batch interface to do the same. - Since user links are often rendered in large pagers, a batch interface is needed. What: - Add IUserRegistrationProvider::fetchRegistrationBatch(), which takes an iterable of UserIdentities and returns a map of their registration timestamps (or null if not available), keyed by user ID. Although this interface is marked as stable to implement, its sole non-core implementor according to codesearch is CentralAuth. - Add UserRegistrationLookup::getFirstRegistrationBatch(), which delegates to fetchRegistrationBatch() on configured registration providers and returns the earliest registration timestamp for each user in the batch. - To avoid potential interface incompatibility in WMF production, this depends on CentralAuth implementing the new IUserRegistrationProvider method first. Bug: T358469 Depends-On: Ibe28163e962161567d486607e36d999a36a1e604 Change-Id: I1f6af2693a8f0c5c854b8a6b04edd1eb21934007
* block: Add a BlockTarget class hierarchyTim Starling2025-02-192-1/+217
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Main change: * Add a class hierarchy representing block targets, representing a target and type. * Add BlockTargetFactory, replacing BlockUtils. * Add CrossWikiBlockTargetFactory, replacing BlockUtilsFactory. * Construct a BlockTarget object early in the request flow and pass it down through the layers, instead of having every layer interpret UserIdentity|string target specifications. Also: * Remove Block::TYPE_ID. Nothing uses it in code search, so there's no point in porting it to the new system. * Stop using the type constants as specificity scores. Add BlockTarget::getSpecificity(). * Add DatabaseBlockStore::newUnsaved() to replace direct construction of DatabaseBlock in insertBlock() callers. There are many such callers in tests. This is part of the effort to remove the service container usage in DatabaseBlock::__construct(). * Make DatabaseBlock::getRangeStart() and getRangeEnd() return null if the block is not a range, since that is convenient for their only caller following the resolution of T51504. * Add DatabaseBlock::getIpHex() which similarly maps to a DB field in the new schema. * In ApiBlock and ApiUnblock, have ParamValidator provide UserIdentity objects instead of converting to a string and back to a UserIdentity again. Bug: T382106 Change-Id: I2ce1a82f3fbb3cf18aa2d17986d46dbdcc70c761
* Merge "block: Fix vague target requirements in BlockPermissionChecker"jenkins-bot2025-02-181-7/+4
|\
| * block: Fix vague target requirements in BlockPermissionCheckerTim Starling2025-02-131-7/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The doc comment of newBlockPermissionChecker() describes the $target parameter as being optional. The returned object does not need or use a target when checkBasePermissions() or checkEmailPermissions() are called. But failing to pass a target when calling checkBlockPermissions() is incorrect. This was the subject of the linked bug. If an admin is performing a block, self-unblock permissions need to be checked, this is not optional. This could be enforced at runtime, but it seems safer and simpler to enforce it statically. So, move $target from being a constructor parameter to being a formal parameter of checkBlockPermissions(). This formal parameter will be statically required after a deprecation period. Deprecate newBlockPermissionChecker() and introduce newChecker(), using a name with a slightly less than conventional verbosity to allow us to change the parameter order. There is no $target parameter to newChecker(). Backwards compatibility is supported by adding an internal mutator method setTarget(). This can easily be removed after the deprecation period is over. In Special:Block, checkBlockPermissions() was called with $target=null on form entry, meaning that the user could unblock themselves if the target was specified in the URL, but could not unblock themselves by searching with the form. This seems inconsistent. So allow blocked admins to see the search form, but show an error when they try to block or unblock someone other than themselves. Bug: T384716 Change-Id: I8c26cdcc9b87b74bc458fe731cf7f170a2607150