aboutsummaryrefslogtreecommitdiffstats
path: root/tests/phpunit/includes/context/RequestContextTest.php
Commit message (Collapse)AuthorAgeFilesLines
* tests: Consolidate legacy Context tests into integration suiteJames D. Forrester2023-01-171-199/+0
| | | | | | None of these are stand-alone unit tests. Change-Id: I5b48cffd000a0f758bc7a24b07cebb30b68fde01
* Setup: Promote clearActionName log message to runtime warning (2)Krinkle2022-11-081-1/+2
| | | | | | | | | This reverts dc3bd3d721 (I385dca1d95) and re-applies d4ce0f3255 (Ib9fc34ca64). The CI failures have been addressed. Bug: T314008 Change-Id: I35a4f656c31b67ebb662bf6f6366f4ee846ecbda
* Reorg: Move some of request related classes to MediaWiki/RequestAmir Sarabadani2022-10-281-0/+1
| | | | | | | | | | | | | | | Redoing I5ea70120d74 but without moving WebRequest that caused issues with phan-taint-plugin. Moving: - DerivativeRequest - FauxRequest - FauxRequestUpload - PathRouter - WebRequestUpload Bug: T321882 Change-Id: I832b133aaf61ee9f6190b0227d2f3de99bd1717b
* Revert "Reorg: Move some of request related classes to MediaWiki/Request"Zabe2022-10-271-1/+0
| | | | | | | | | This reverts commit 2bdc0b2b7209441a42a784157633a8a01b321922. Reason for revert: T166010#8349431 Bug: T166010 Change-Id: Idcd3025647aec99532f5d69b9c1718c531761283
* Reorg: Move some of request related classes to MediaWiki/RequestAmir Sarabadani2022-10-261-0/+1
| | | | | | | | | | | | | Moving: - DerivativeRequest - FauxRequest - FauxRequestUpload - PathRouter - WebRequest - WebRequestUpload Bug: T166010 Change-Id: I5ea70120d745f2876ae31d039f3f8a51e49e9ad8
* tests: Replace deprecated WikiPage::factoryUmherirrender2022-09-021-1/+1
| | | | | Bug: T297688 Change-Id: Ic84d491c5603f3590e26cb56a305508b2b0ca109
* Revert "Setup: Promote clearActionName log message to runtime warning"Awight2022-07-121-2/+1
| | | | | | | | | This reverts commit d4ce0f3255ad2b830396bab90947952dec9f8ea4. Reason for revert: Causes unrelated test failures, ideally usages are made safe before the patch is merged. Bug: T312838 Change-Id: I385dca1d95033961d3844e888521750443e49c95
* Setup: Promote clearActionName log message to runtime warningTimo Tijhof2022-07-121-1/+2
| | | | | | | | | | | | Introduced in 3fdfef96e4ee (I1e259b54dca4), and as of d7beb0e4ec7 (I72ffc9f36613bf9) the debug message is no longer triggered in a typical local install, nor in production. Also: * Improve detection and attribution by removing the last bit of cache duplication in MediaWiki.php and defer to RequestContext.php. Change-Id: Ib9fc34ca64b7c0e89a774bee9a36fa3882eb4ec3
* tests: Use Title::makeTitle instead of Title::newFromTextUmherirrender2022-07-061-3/+3
| | | | | | Avoid parsing known titles in tests to improve performance Change-Id: Ibfccfe696f0b8bfda0b99abae324e60bbecef7d8
* context: Add a cached RequestContext::getActionName methodTimo Tijhof2022-03-251-0/+55
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This method is dependent on, and inherently must depend on, all of Title, WikiPage, and WebRequest. And, like Title and WikiPage, which also have getters in RequestContext, Action is also derived from a query parameter that is widely recognised in almost all web requests to index.php. The status quo in core and extensions, is to obtain this value via Action::getActionName(), which as a static method that bypasses dependency injection and also has the problem of not being cached. Caching it within ActionFactory seems hard and awkward, due to varying by context. In change I61d66211bd (22f9a32853f) a cached wrapper method was added internally to the Skin class. In change I8cbc4bba4d248d9 (235820d631) another cached wrapper was added in the Gadgets extension. This change takes this approach further by making it a stable public method on RequestContext. To facilitate testing and to offer basic confidence in this working correctly, this commit also adopts the new method in two place that are considered "safe" (Skin, and OutputPage). Both of these are called relatively late in the PHP proccess and well after any Setup code and overrides (such as in MediaWiki.php), during which it is more complex to call this. I'll audit and update those in a subsequent change. Change-Id: I1e259b54dca48a32be5a8c6cbb8eb69aec2da115
* Revert "Replace deprecated methods IContextSource::getWikiPage && ↵Legoktm2021-12-141-5/+2
| | | | | | | | | | | IContextSource::canUseWikiPage" This reverts commit ef458e894888d5d984f6b8dcf75cfae008d544d0. Reason for revert: Causes page tabs to disappear on Special:WhatLinksHere. Bug: T297744 Change-Id: I0ee282a9f7a5a9b2cfdc3261d800d9e27eaf977e
* Replace deprecated methods IContextSource::getWikiPage && ↵Roman Stolar2021-11-161-2/+5
| | | | | | | IContextSource::canUseWikiPage Bug: T275710 Change-Id: I74b8f76a525793bc029d9ee1f7297b46ac0a9174
* Remove $actor field from UsererIdentityValuedaniel2021-04-131-1/+1
| | | | | | | | | | | | | | | | | Code that needs to store an actor ID in the database to represent a UserIdentity, or needs to construct a UserIdentity based on an actor ID loaded from the database, should use the ActorNormalization service. Note: The getActorId() method is removed from the UserIdentity interface, but all concrete classes continue to support it for now. UsererIdentityValue::getActorId() is hard deprecated and should be removed in 1.37. It always returns 0. User::getActorId() is not deprecated at this point. Bug: T274179 Depends-On: Id2b3ddf6a2a7cdf90f8936a69148d2cce6fde237 Change-Id: I9925906d11e47efaec3c1f48d5cb3f9896a982c1
* Rename Authority::getPerformer() to ::getUser()Petr Pchelko2021-03-041-2/+2
| | | | | | | We started to call Authority argument $performer everywhere, and $performer->getPerformer() doesn't look that good. Change-Id: Id2cf3f27b18340314e4ed1ea9931ad9404b4df6f
* Rename Authority::getActor to Authority::getPerformerPetr Pchelko2021-02-221-2/+2
| | | | | Bug: T274947 Change-Id: I8f652816af00bf9fa413ba4b1fa7ac4c27290dc2
* Add Authority to ContextPetr Pchelko2021-01-201-0/+26
| | | | | Bug: T271460 Change-Id: If1038c94ccf8f3e59b5242f5c33b66f076c60816
* Swap out uses of User->isLoggedIn() with ->isRegistered()James D. Forrester2020-12-221-1/+1
| | | | | Bug: T270450 Change-Id: I90ff94a553ebae9a4ef97c25c333f067f19c327d
* RequestContextTest: No need to set $wgUserDannyS7122020-09-131-1/+0
| | | | | | | | Not read from in importScopedSession, only written to Bug: T243708 Change-Id: I57d1c54fd19b810a37843c3823824da2465108a9
* MediaWikiTestCase to MediaWikiIntegrationTestCaseaddshore2020-06-301-1/+1
| | | | | | | | | | | | | The name change happened some time ago, and I think its about time to start using the name name! (Done with a find and replace) My personal motivation for doing this is that I have started trying out vscode as an IDE for mediawiki development, and right now it doesn't appear to handle php aliases very well or at all. Change-Id: I412235d91ae26e4c1c6a62e0dbb7e7cf3c5ed4a6
* Coding style: Auto-fix MediaWiki.Usage.PHPUnit*James D. Forrester2020-01-101-1/+1
| | | | Change-Id: I86fc55a4fc8ceafe368692173211bbcd6d8581d7
* tests: Prefer assertSame() when comparing the integer 0Thiemo Kreuz2019-09-191-1/+1
| | | | | | | assertSame() is guaranteed to not do any type conversion. This can be critical when acciden tially comparing, for example, 0 to 0.0. Change-Id: Iffcc9bda69573623ba14af655dcd697d0fcce525
* Fix numerous class/function casingReedy2016-03-181-1/+1
| | | | Change-Id: I23982bfa0548c9ea3bdb432be7982f1563930715
* Convert all array() syntax to []Kunal Mehta2016-02-171-6/+6
| | | | | | | | | | Per wikitech-l consensus: https://lists.wikimedia.org/pipermail/wikitech-l/2016-February/084821.html Notes: * Disabled CallTimePassByReference due to false positives (T127163) Change-Id: I2c8ce713ce6600a0bb7bf67537c87044c7a45c4b
* Revert "Remove SessionManager, temporarily"Brad Jorsch2016-02-031-1/+22
| | | | | | This reverts commit 823db5d63dd5200d04c63da50ba6bf16f928e70b. Change-Id: Ibb3e023e4eb6715295586dea87d0725c344a8271
* Remove SessionManager, temporarilyBrad Jorsch2016-02-011-22/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The plan here is to take it out of 1.27.0-wmf.12 and put it back in 1.27.0-wmf.13. Since BotPasswords depends on SessionManager, that's getting temporarily removed too. This reverts the following commits: * 6acd424e0dbc322e8b9a141bd2625453c1b9b6f1 SessionManager: Notify AuthPlugin before calling hooks * 4d1ad32d8acbd443346253d2f6a95024c833295c Close a loophole in CookieSessionProvider * fcdd643a46d87b677f6cdcc3ba9440e1472d8df7 SessionManager: Don't save non-persisted sessions to backend storage * 058aec4c76129b7ee8541692a8a48f8046e15bb6 MessageCache: Don't get a ParserOptions for $wgUser before the end of Setup.php * b5c0c03bb708f8dad6e404969df8addc123984db SessionManager: Save user name to metadata even if the user doesn't exist locally * 13f2f09a193215aa7a061d10a1955e172d06fa0a SECURITY: Fix User::setToken() call on User::newSystemUser * 305bc75b27903237a9683ec1f329bcbec0ecd266 SessionManager: Don't generate user tokens when checking the tokens * 7c4bd85d2152fd9fa975ea0fb5ffb1a0b804f99b RequestContext::exportSession() should only export persisted session IDs * 296ccfd4a9a6ad3ae412db7e2408c923aaa61f64 SessionManager: Save 'persisted' flag in session metadata * 94ba53f67731b0553a6178841d9506e384f74496 Move CSRF token handling into MediaWiki\Session\Session * 46a565d6b00174e631d2022b47677e1a78e73897 Avoid false "added in both Session and $_SESSION" when value is null * c00d0b5d94c946b8883dd7062bf7160a199aa5c2 Log backtrace for "User::loadFromSession called before the end of Setup.php" * 4eeff5b559e2ae7b8fa1f45572968ba28573a421 Use $wgSecureCookie to decide whether to actually mark secure cookies as 'secure' * 7491b52f700e220814a8190781fd794b4dd88a20 Call session_cache_limiter() before starting a session * 2c34aeea72471f9a598e67bdbf34bc5f9fb3f0c5 SessionManager: Abstract forceHTTPS cookie setting * 9aa53627a53aabec0273cecf45a86e77927ef406 Ignore auth cookies with value 'deleted' * 43f904b51a746d7f71ea2ab9951c5c98d269765b SessionManager: Kill getPersistedSessionId() * 50c52563528ba3d765c3762211f98d6f3c0e39fd SessionManager: Add SessionBackend::setProviderMetadata() * f640d403154bc0a2b4f6d399582797a9e3bc6fcb SessionManager: Notify AuthPlugin when auto-creating accounts * 70b05d1ac1e859bac2185b246e9b93ec9051e4d8 Add checks of $wgEnableBotPasswords in more places * bfed32eb78b6c720b16bc7ed60153fd2fe257a9e Do not raise a PHP warning when session write fails * 722a7331ad8d98228511f8da38adc7a3c64dd617 Only check LoggedOut timestamp on the user loaded from session * 4f5057b84b36eccd16627a6b29831dfdb4483b02 SessionManager: Change behavior of getSessionById() * 66e82e614e157e39b03d813e71ddf23f53cf640b Fix typo in [[MediaWiki:Botpasswords-editexisting/en]] * f9fd9516d922d36291037baca7205a2b0ac9f15f Add "bot passwords" * d7716f1df0b692902571bf415a0984071e3e9a60 Add missing argument for wfDebugLog * a73c5b7395a07d490f7052fd3b2491ebd656b190 Add SessionManager Change-Id: I2389a8133e25ab929e9f27f41fa9a05df8147a50
* RequestContext::exportSession() should only export persisted session IDsBrad Jorsch2016-01-271-0/+4
| | | | | | | | | If a non-persisted session ID is exported, then when the session is reloaded by RequestContext::importScopedSession() the session_start() will wind up persisting it. Bug: T124971 Change-Id: If03d130acca6bb98029cfa3cc520cd46f42ff15e
* Add SessionManagerBrad Jorsch2016-01-121-1/+18
| | | | | | | | | | | | | | | SessionManager is a general-purpose session management framework, rather than the cookie-based sessions that PHP wants to provide us. While fallback is provided for using $_SESSION and other PHP session management functions, they should be avoided in favor of using SessionManager directly. For proof-of-concept extensions, see OAuth change Ib40b221 and CentralAuth change I27ccabdb. Bug: T111296 Change-Id: Ic1ffea74f3ccc8f93c8a23b795ecab6f06abca72
* Move Test files under same folder structure where class is (/includes/)umherirrender2014-12-161-0/+96
Change-Id: I95f1aa6f0ed2cc3306aa6e588a11f359854315c1