aboutsummaryrefslogtreecommitdiffstats
path: root/tests/phpunit
Commit message (Collapse)AuthorAgeFilesLines
* Merge "Stats: Fix "MediaWiki.PHPUnit.AssertEquals.Int" in UnitTestingHelperTest"jenkins-bot2025-04-041-4/+2
|\
| * Stats: Fix "MediaWiki.PHPUnit.AssertEquals.Int" in UnitTestingHelperTestTimo Tijhof2025-04-031-4/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Follows-up I1b9435dcdacd952b, which introduced this and silenced the warning, but it appears this warning is spot-on: > $ composer phpcs > … > assertEquals accepts many non-zero values, please use strict alternatives like > assertSame (MediaWiki.PHPUnit.AssertEquals.Int) We don't want to tolerate something like this: ``` var_dump(1 == true); class Foo{} var_dump(1 == new Foo()); var_dump(1 == (object)[]); var_dump(1 == new stdClass); var_dump(1 == '01.0'); var_dump(1 == '01.'); var_dump(1 == '01'); var_dump(1 == '1'); ``` Bug: T368740 Change-Id: Ib3966b96f65d41b1d320ae043dcbea1a445a55f5
* | In .htaccess deny files, use "Satisfy All"Tim Starling2025-04-041-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | These .htaccess files are intended to prohibit all web access. But if the user sets "Satisfy Any" on a parent directory, in conjunction with any permissive require directive like "Require all granted", access will be allowed despite "Require all denied" in .htaccess. So, override Satisfy so that the "Require all denied" will reliably take effect. Note that "Satisfy All" is the default. This only affects non-default installations. Change-Id: Ia5862fb69e439b7ea2ed7af011e1ebf8f1b1f6d6
* | Merge "DomainEvent: rename EventIngressBase to DomainEventIngress"jenkins-bot2025-04-042-7/+7
|\ \
| * | DomainEvent: rename EventIngressBase to DomainEventIngressAaron Schulz2025-04-032-7/+7
| | | | | | | | | | | | | | | Bug: T390735 Change-Id: I0ebec537bb15925e8507ee6934cd4a17973c536a
* | | Merge "globalcontributions: Tolerate trailing spaces on special:contributions"jenkins-bot2025-04-031-0/+42
|\ \ \ | |/ / |/| |
| * | globalcontributions: Tolerate trailing spaces on special:contributionsHéctor Arroyo2025-04-031-0/+42
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Why: - When accessing Special:GlobalContributions, if the target to look for ends with a whitespace, the page returns no results, showing an error stating that the target is not a valid user name instead. To test it, you can provide a target ending with a whitespace in the URL, like ?title=Special:GlobalContributions&target=172.22.0.1+&namespace=all (note the plus sign at the end of the target). - When accessing the page, different code paths seem to expect having the user name provided in different ways (reading it from the request itself, getting it passed as a value, or reading it from the controller's $opts attribute). What: - Cleanup the target before the actual logic for the contributions special pages starts, making all contributions pages (including global contributions) read the user name after stripping the leading and trailing whitespaces, if any. Bug: T378279 Change-Id: I9f6a0d70d2d967cf5ec33c77bffa89c90fb81e25
* | | Merge "Client-side date/time formatter library"jenkins-bot2025-04-022-0/+198
|\ \ \ | |/ / |/| |
| * | Client-side date/time formatter libraryTim Starling2025-04-022-0/+198
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add a library providing date/time formatting according to the user's preferred time zone and date preference. I tested formatting of an example date with all defined formats in all languages, and I found that it gives identical output to PHP in about 90% of our ~500 languages. Resolve some of the outstanding issues by aliasing the problematic date formats on the client side, so that the user will see the date in another acceptable format for the same language. The remaining issues mostly relate to the use of a fallback language to display weekdays and non-Gregorian month names. Details: * Add Language::getJsDateFormats(), which converts existing date formats to an options array that can be interpreted by the client. * In Messages*.php, add $numberingSystem, which is the CLDR numbering system ID. I set it for all languages that had overriden $digitTransformTable. This is sent to the client in the library's JSON config and is used as the default numberingSystem option when formatting dates. * In Messages*.php, add $jsDateFormats, which overrides the automatically generated date format options. Bug: T389161 Change-Id: Ib6bc8ebd4d01317aaf32225c6006ea2dc7a1b39e
* | | Merge "block: Add autoblock filtering parameters"jenkins-bot2025-04-021-0/+40
|\ \ \ | |/ / |/| |
| * | block: Add autoblock filtering parametersTim Starling2025-03-211-0/+40
| | | | | | | | | | | | | | | | | | | | | | | | Add $auto parameter to DatabaseBlockStore::newFromTarget and ::newListFromTarget, to help callers filter autoblocks from result lists. Change-Id: Iad92d205517eb50ab0ce5e8caae58ee761fe19d5
* | | Merge "ParserCache: Skip saving of "redirect=no" ParserOutput of redirect pages"jenkins-bot2025-04-011-193/+834
|\ \ \
| * | | ParserCache: Skip saving of "redirect=no" ParserOutput of redirect pagesdaniel2025-04-011-193/+834
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Why: - ParserCache refuses to return cache entries for redirect pages. So we shouldn't write these entries into the parser cache in the first place. - If we write but refuse to read, this means there will be a cache write every time a redirect page is retrieved via ParserOutputAccess. What: - Make ParserCache:save() skip entries for redirect pages. This is only reachable via "redirect=no" since by default MediaWiki pageviews render the destination page instead. Note: - It seems we should be able to store redirect pages like any other page in the ParserCache. Why we didn't, and whether we should, is not yet clear. While this is being investigated we should establish consistent behavior for get() and save(). Bug: T389591 Change-Id: I880997193d6de66121c902de80a77c1305bd01d3
* | | | Merge "tests: Use more trivial no-op and null implementations"jenkins-bot2025-04-012-9/+3
|\ \ \ \ | |_|_|/ |/| | |
| * | | tests: Use more trivial no-op and null implementationsthiemowmde2025-04-012-9/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | There are dedicated classes and methods for this. No need to redo the same manually. Change-Id: I75f5c1f0911f5fcdc63414943747cb3fca664a8e
* | | | tests: Use type declaration on undocumented private functionsUmherirrender2025-03-3012-16/+17
| | | | | | | | | | | | | | | | Change-Id: I56b31870ce9be46d15fcd9095f9a12e0f2488ed9
* | | | Merge "ResourceLoader: Remove unused 'dir' parameter to load.php"jenkins-bot2025-03-283-28/+10
|\ \ \ \
| * | | | ResourceLoader: Remove unused 'dir' parameter to load.phpTimo Tijhof2025-03-253-28/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When MediaWiki creates load.php URLs, in OutputPage and via RL\Client, it sets 'lang', not 'dir'. The direction is automatically derived from the language, which makes the library easier to use for developers, and also avoids a potentially confusing scenario in which the two are different (e.g. lang=he and dir=ltr would not make sense, and would further risk poisoning LTR content in an RTL/Hebrew-related cache somewhere). Bug: T225845 Change-Id: I14905c85bb5e3bb47a681dc99668b92844d22f04
* | | | | Localize duration number in Watchlist editorHuji2025-03-281-7/+23
| |_|/ / |/| | | | | | | | | | | | | | | Bug: T387255 Change-Id: I3c39db9d8394254b94f0828de0df4fb57e8d49e7
* | | | Merge "ResourceLoader: Reject module names starting with "./" && "../""jenkins-bot2025-03-271-0/+7
|\ \ \ \
| * | | | ResourceLoader: Reject module names starting with "./" && "../"Hannah Okwelum2025-03-271-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | These already don't work in modules with packageFiles since these are invalid under CJS/require interop, but to remove any chance of ambiguity or confusing error messages client-side, let's also validate these early server-side, so that we can assume no such module can exist. Bug: T386833 Change-Id: I854079bb8c56e0b7adc899769bc365bf31226a05
* | | | | Merge "REST: fix extra routes module localization strings"jenkins-bot2025-03-271-1/+1
|\ \ \ \ \
| * | | | | REST: fix extra routes module localization stringsbpirkle2025-03-261-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A previous change to add localization strings for the REST extra routes module was inconsistent between the en/qqq json files and the message name in php, causing the strings to display incorrectly in the REST Sandbox. Fix so the messages display correctly. Bug: T385855 Change-Id: I6c8d825a98ee36218cd23e3945c42010c9bd5ef3
* | | | | | objectcache: Remove internal StorageAwareness, now unusedTimo Tijhof2025-03-271-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Update a few remnant references inside the library while at it. * WANObjectCache: Didn't use ATTR/QOS directly, and getQoS test already implemnented as BagOStuff const. Update getQoS() docs to match. * WANObjectCache: Already documented ERR_ as BagOStuff::ERR_. And Codesearch confirms no use of `WANObjectCache::(ERR|ATTR|QOS)`. * MemcachedClient: Switch from referencing one to the other. The class is not directly used outside core, only via BagOStuff. * Implicitly remove unused ATTR_EMULATION by not carrying over. Follows-up: * e8275758fe (I20fde9fa5c) Split IExpiringStore from BagOStuff, and re-use in WANObjectCache. * 74be3a0150 (I4377fc3f53) Move ERR_ from BagOStuff to IExpiringStore. * 69950da666 (Ia862c5111a) Replace IExpiringStore with StorageAwareness. * 59b002b866 (I9885f53f00) Remove StorageAwareness::QOS_LOCALITY_. * ec90b543ab (I8dec3f73fa) Remove StorageAwareness::QOS_EMULATION_SQL. * 62bdd78817 (I5649a29310) Adopt ERR_ in MemcachedClient. * e5a3e36bd1 (I836735b1fe) Mark StorageAwareness as internal. Bug: T353529 Bug: T364652 Change-Id: I1dfde995e29d5264611cf3500d61fe4d8631a7d7
* | | | | | Merge "ResourceLoader: Add page title to user script syntax error"jenkins-bot2025-03-262-4/+4
|\ \ \ \ \ \ | |/ / / / / |/| | | | |
| * | | | | ResourceLoader: Add page title to user script syntax errorTimo Tijhof2025-03-262-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This follows-up Ie309e761f (53a3c8b417), in which we switched from calling JsMinPlus/JSParser (which took $fileName as argument, and throw an exception that already included "on line N in X.js") to calling Peast. That patch formatted the error as "on line N" but forgot to include "in X.js". Test plan: * Log in as admin and create "MediaWiki:Common.js" with "foo/;", which is invalid syntax. Then browse the main page and check the browser console. * Before: "Parse error: Unexpected: ; on line 1" * After: "Parse error: Unexpected: ; on line 1 in MediaWiki:Common.js" While at it, document why this cache key is not purely MD5-based, but also includes wiki and page title. Change-Id: I16c3b1dacd02ee26a254809e6a9ac60f72aba4da
* | | | | | Merge "htmlform: Drop HTMLForm::*Text and FormSpecialPage::*Text functions, ↵jenkins-bot2025-03-261-22/+2
|\ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | deprecated in 1.38"
| * | | | | | 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 "api: Remove deprecated ApiPageSet::get*Titles"jenkins-bot2025-03-261-25/+2
|\ \ \ \ \ \
| * | | | | | api: Remove deprecated ApiPageSet::get*TitlesUmherirrender2025-03-261-25/+2
| |/ / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The following functions were removed: - ApiPageSet::getTitles - ApiPageSet::getGoodTitles - ApiPageSet::getMissingTitles - ApiPageSet::getGoodAndMissingTitles - ApiPageSet::getRedirectTitles - ApiPageSet::getSpecialTitles Bug: T339384 Change-Id: Iba8499c2d1b4a10b918f563069534b90fed7f6f9
* / / / / / page: Remove deprecated PageArchive::undeleteAsUserUmherirrender2025-03-261-55/+0
|/ / / / / | | | | | | | | | | | | | | | | | | | | Bug: T339394 Change-Id: I4c7dd048913ee3d62982ec3bcbdb37548bd56280
* | | | | Merge "Migrate MediaWiki.jobqueue to statslib"jenkins-bot2025-03-261-2/+2
|\ \ \ \ \
| * | | | | Migrate MediaWiki.jobqueue to statslibAtieno2025-03-241-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch migrates the `MediaWiki.jobqueue` metric to the new Prometheus format. Bug: T359472 Change-Id: Ie1d54721a1849619fe9a33b74ad1c231868b1c26
* | | | | | Merge "HookRunnerTestBase: Minor fixups"jenkins-bot2025-03-261-3/+5
|\ \ \ \ \ \ | |_|_|/ / / |/| | | | |
| * | | | | HookRunnerTestBase: Minor fixupsReedy2025-03-251-3/+5
| | | | | | | | | | | | | | | | | | | | | | | | Change-Id: I215eb8cccd50472b4fcb0f41ce1710d8ff9ca8fc
* | | | | | Merge "DomainEvents: Model page state before/after"jenkins-bot2025-03-253-12/+16
|\ \ \ \ \ \ | |/ / / / / |/| | | | |
| * | | | | DomainEvents: Model page state before/afterdaniel2025-03-253-12/+16
| | |_|/ / | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | | | | Merge "Namespace all remaining files in includes/skin"jenkins-bot2025-03-259-11/+11
|\ \ \ \ \
| * | | | | Namespace all remaining files in includes/skinJames D. Forrester2025-03-259-11/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Bug: T353458 Change-Id: I3e829e35c93bcaae75e401b1801bddf93c0b416c
* | | | | | Merge "Namespace all remaining files in includes/changetags"jenkins-bot2025-03-255-8/+9
|\| | | | |
| * | | | | Namespace all remaining files in includes/changetagsJames D. Forrester2025-03-255-8/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Bug: T353458 Change-Id: I3cf44dfe5425f2efb8409c83571c427447b053af
* | | | | | Merge "Namespace all remaining files in includes/exception"jenkins-bot2025-03-2522-24/+31
|\| | | | |
| * | | | | Namespace all remaining files in includes/exceptionJames D. Forrester2025-03-2522-24/+31
| |/ / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 ""(diff | hist)" are plain text and have no links for categorization ↵jenkins-bot2025-03-251-0/+34
|\ \ \ \ \ | |/ / / / |/| | | | | | | | | entries in Recent Changes and Watchlist in non-grouping mode"
| * | | | "(diff | hist)" are plain text and have no links for categorization entries ↵Kgraessle2025-03-201-0/+34
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | in Recent Changes and Watchlist in non-grouping mode Bug: T148533 Change-Id: I33d3f186c1b59c2fa1a0ed7c588ed14e63a49559
* | | | | Merge "Deprecate OutputPage::showNewSectionLink(), ::forceHideNewSectionLink()"jenkins-bot2025-03-241-0/+3
|\ \ \ \ \
| * | | | | Deprecate OutputPage::showNewSectionLink(), ::forceHideNewSectionLink()C. Scott Ananian2025-03-241-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The OutputPage::getOutputFlag(...) method should be used instead. Bug: T301020 Change-Id: I3b5a76d30e88da1f29e50689cfab7d05ff83e43f
* | | | | | Merge "Split OutputPage::getModulesInternal()"jenkins-bot2025-03-241-1/+1
|\ \ \ \ \ \ | |/ / / / / |/| | | | |
| * | | | | Split OutputPage::getModulesInternal()C. Scott Ananian2025-03-221-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In preparation for moving the module lists to OutputPage::$metadata, deprecate the additional parameters to OutputPage::getModules() and OutputPage::getModuleStyles(); refactoring the actual implementation to a new private method OutputPage::getModulesInternal(). Bug: T301020 Change-Id: Iea1a40fed68d3b61b8decf9ab838391b1477ff95
* | | | | | Merge "Deprecate OutputPage::getNoGallery()"jenkins-bot2025-03-241-0/+1
|\ \ \ \ \ \