aboutsummaryrefslogtreecommitdiffstats
path: root/tests/phpunit/includes/session/SessionInfoTest.php
Commit message (Collapse)AuthorAgeFilesLines
* Merge "tests: Fix @covers and @coversDefaultClass to have leading \"jenkins-bot2024-02-161-1/+1
|\
| * tests: Fix @covers and @coversDefaultClass to have leading \Reedy2024-02-161-1/+1
| | | | | | | | Change-Id: I5629f91387f2ac453ee4341bfe4bba310bd52f03
* | tests: More use statements in session testsReedy2024-02-161-9/+11
|/ | | | Change-Id: I562236f45c0fef5ad2b8fba5d3584b4ddd38a17a
* tests: Add Tests to PHP namespacingReedy2024-02-161-1/+5
| | | | Change-Id: I849268172751d50292e93aa75abe8094873f56bc
* Replace a few manually crafted assertTrue assertionsthiemowmde2023-11-231-3/+3
| | | | | | | … replace them with the named convenience methods provided by PHPUnit. Change-Id: Ib46dbc3ab7926cf176477254f466b9bdd3be7c46
* Do not use UTSysop directly in testsDaimona Eaytoy2023-08-161-4/+5
| | | | | | | | If the test expects the user to exist, it should use getTestSysop to guarantee the account creation. Otherwise, use mocks or different usernames to clarify that the username is not relevant to the test. Change-Id: I87a27f01e1874af410e5d43e2e7fc3b10bb14eb8
* Create SessionProviderTestTrait to facilitate testing of an SessionProvidervladshapik2021-05-261-17/+3
| | | | | | | | | Create new SessionProviderTestTrait and SessionProviderTestTrait::initProvider method. Replace uses of SessionProvider::init with new method in tests. Bug: T283709 Change-Id: I2770188faf3e4f374f9df885ff4deff7189063fc
* Create an initialization method in the SessionProvider classvladshapik2021-05-041-2/+17
| | | | | | | | | | | | | init() method was added to SessionProvider. It helps to inject dependecies. Overridable postInitSetup() method was added to SessionProvider. A provider can override this to do any necessary setup. SessionProvider ::setLogger(), ::setManager(), ::setConfig(), ::setHookContainer() were soft deprecated. Now developers must use SessionProvider::init() Bug: T275030 Change-Id: I958797881251572e4ec22e7dd9d13f74f7e216a3
* Replace PHPUnit ->returnValue() with ->willReturn() shortcutThiemo Kreuz2021-04-221-12/+12
| | | | | | | | | | | | It's the same and makes the test code much more readable, I would like to argue. Because of the was I split all the changes I made into smaller patches this patch contains some other changes in the same lines where I could not split them off. E.g. removal of ->any(), which is the default anyway and doesn't do anything. Change-Id: Ib297b989d4aec33b31a4e33fe9d5032865b39be0
* phpunit: Mass-replace setMethods with onlyMethods and adjustDaimona Eaytoy2021-04-161-2/+2
| | | | | | | | | | | | Ended up using grep -Prl '\->setMethods\(' . | xargs sed -r -i 's/setMethods\(/onlyMethods\(/g' special-casing setMethods( null ) -> onlyMethods( [] ) and then manual fix of failing test (from PS2 onwards). Bug: T278010 Change-Id: I012dca7ae774bb430c1c44d50991ba0b633353f1
* MediaWikiTestCase to MediaWikiIntegrationTestCaseaddshore2020-06-301-2/+2
| | | | | | | | | | | | | 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
* Revert "Separate MediaWiki unit and integration tests"Legoktm2019-06-131-0/+356
| | | | | | | | This reverts commit 0a2b996278e57a8b8c5377cd3a3eaa54f993d4a9. Reason for revert: Broke postgres tests. Change-Id: I27d8e0c807ad5f0748b9611a4f3df84cc213fbe1
* Separate MediaWiki unit and integration testsMáté Szabó2019-06-131-356/+0
| | | | | | | | | | | | | | | | | | | | | This changeset implements T89432 and related tickets and is based on exploration done at the Prague Hackathon. The goal is to identify tests in MediaWiki core that can be run without having to install & configure MediaWiki and its dependencies, and provide a way to execute these tests via the standard phpunit entry point, allowing for faster development and integration with existing tooling like IDEs. The initial set of tests that met these criteria were identified using the work Amir did in I88822667693d9e00ac3d4639c87bc24e5083e5e8. These tests were then moved into a new subdirectory under phpunit/ and organized into a separate test suite. The environment for this suite is set up via a PHPUnit bootstrap file without a custom entry point. You can execute these tests by running: $ vendor/bin/phpunit -d memory_limit=512M -c tests/phpunit/unit-tests.xml Bug: T89432 Bug: T87781 Bug: T84948 Change-Id: Iad01033a0548afd4d2a6f2c1ef6fcc9debf72c0d
* Add SessionInfo force-use flagBrad Jorsch2016-05-101-0/+29
| | | | | | | | | | | | | | | | | | | A provider that uses SessionProvider::hashToSessionId() will likely have issues if something such as a call to $user->setToken() causes SessionManager::loadSessionInfoFromStore() to fail, since the provider can't just arbitrarily change the session ID it returns. The two solutions to this problem are: * Somehow include everything that could cause loadSessionInfoFromStore to fail in the data hashed by hashToSessionId. * Flag the SessionInfo so that, if stored data and the SessionInfo conflict, it should delete the stored data instead of discarding the SessionInfo. Since the second is less complexity overall due to the lack of need to define "everything", this patch takes that approach. Change-Id: I8c6fab2ec295e71242bbcb19d0ee5ade6bd655df
* Use ::class in place of string constantsBrad Jorsch2016-03-281-2/+2
| | | | | | | This takes advantage of namespacing, and avoids having double-backslashes all over the place. Change-Id: I450fe4e9b1c4cf4e24fced3932fe796cbbadf3a3
* Convert all array() syntax to []Kunal Mehta2016-02-171-55/+55
| | | | | | | | | | 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
* Remove unused imports from Session classesThiemo Mättig2016-02-101-1/+0
| | | | Change-Id: Ia3cdd923728870f5eff0bd90fd2f6605047291c0
* Revert "Remove SessionManager, temporarily"Brad Jorsch2016-02-031-0/+328
| | | | | | This reverts commit 823db5d63dd5200d04c63da50ba6bf16f928e70b. Change-Id: Ibb3e023e4eb6715295586dea87d0725c344a8271
* Remove SessionManager, temporarilyBrad Jorsch2016-02-011-328/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Add SessionManagerBrad Jorsch2016-01-121-0/+328
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