Commit graph

28 commits

Author SHA1 Message Date
thiemowmde 8180e6450d Fix confusing usages of TestingAccessWrapper
Some of this is not necessary at all because all properties are
public anyway.

In other cases only one property needs to use the wrapper, the rest
is public and can be accessed normally.

In other cases we just missed the @var annotation to make the IDE
aware of what's actually going on.

Change-Id: I29b526ee3aad9f0c9671fb133c625b9f14309db9
2024-09-17 08:53:41 +00:00
Fomafix 07646e4a65 Replace setMwGlobals by overrideConfigValue/overrideConfigValues
Change-Id: If63e84d8101f2169f684c4db822f7df907d2deec
2024-07-22 13:33:09 +00:00
Umherirrender 81d0c7bcd4 Use namespaced classes
Changes to the use statements done automatically via script
Addition of missing use statement done manually

Change-Id: I325f5bab163cddf76dbf8d5a6eca35a7ed7b6df7
2024-06-08 23:46:45 +02:00
Timo Tijhof 5c1fc0f2e0 tests: Remove redundant wgMainCacheType=hash
Follows-up 5b3765f7b, which refactored the way this was set.

Introduced in 2016 with 31c59374a, but redundant since 2020 with
commit c6c62e2c8f in MediaWiki core.

Bug: T139216
Change-Id: Iaf0a2f60833797ecf0b74f69dd797ca3c53cc550
2024-03-29 23:03:41 +00:00
Derick Alangi 5b3765f7b5
Fix ConfirmEdit to avoid global state
ConfirmEdit will try to mess with ObjectCache::$instances, clean this
up so that we migrate consumers to go through ObjectCacheFactory.

Bug: T358346
Change-Id: I317a1a17f4f39e99a9b31660eebcd0185adb88f8
2024-03-07 15:05:23 +03:00
Bartosz Dziewoński 2c6fe24521
Move login attempt counting to a separate class
This has nothing to do with CAPTCHA generation, and the only thing it
needs from the SimpleCaptcha class is checking whether a CAPTCHA on
bad login is enabled at all.

Also improve comments in CaptchaPreAuthenticationProvider. I found the
session flag business really difficult to understand.

Change-Id: I8200531718aaa11effcb07539204e1a05ed432e0
2023-12-13 15:18:39 -08:00
Umherirrender 92bc1f3d2f Use namespaced classes
Changes to the use statements done automatically via script
Addition of missing use statements done manually

Change-Id: Id44f211320e56bc83e4c8f243369dc4eb562cf37
2023-12-11 00:07:55 +01:00
Daimona Eaytoy f988b56d53 Do not use UTSysop directly in CaptchaPreAuthenticationProviderTest
The test sysop account, when needed, should be created with
getTestSysop().

Change-Id: Ie25385fe252ff230dd1d65a5972f69ed794b46b8
2023-08-18 16:32:35 +02:00
Umherirrender 1a440848fa tests: Make PHPUnit data providers static
Initally used a new sniff with autofix (T333745)

Bug: T332865
Change-Id: I74e62a477cb8657da93180cd71432a95e70fff4b
2023-05-20 11:59:50 +02:00
gerritbot f6bd4eb1aa Update moved class FauxRequest
See T321882. Moved in I832b133aaf61ee

Bug: T321681
Change-Id: Ic7accc3410547a0d1ff9d7a04836a7f6e64872f9
2023-05-19 14:15:24 +03:00
Umherirrender cb6254fe5f tests: Replace assertEmpty with assertSame
assertSame avoids use of loose comparisons and
allows to check the expected type

Change-Id: I4e1efb254365ed551c1240c6ab7a8a270969a1d0
2022-11-24 23:02:46 +01:00
Reedy 30cd1d8a23 Namespace base classes
Change-Id: I3fa9747e0ea970c5de39e2da8603e1bba9388a69
2022-07-30 18:13:03 +00:00
libraryupgrader 81a524e2e9 build: Updating dependencies
composer:
* mediawiki/mediawiki-codesniffer: 36.0.0 → 37.0.0

npm:
* postcss: 7.0.35 → 7.0.36
  * https://npmjs.com/advisories/1693 (CVE-2021-23368)
* glob-parent: 5.1.0 → 5.1.2
  * https://npmjs.com/advisories/1751 (CVE-2020-28469)
* trim-newlines: 3.0.0 → 3.0.1
  * https://npmjs.com/advisories/1753 (CVE-2021-33623)

Change-Id: I57837ebf8054a2e968d207fecb3f12397c18e2a2
2021-07-22 14:24:25 +00:00
vladshapik 824ef272dd Replace uses of the deprecated setters of AbstractAuthenticationProvider
Since AbstractAuthenticationProvider ::setLogger, ::setManager,
::setConfig, ::setHookContainer methods had been soft deprecated,
so its usages were removed. AuthenticationProviderTestTrait
::initProvider was used in order to initialize
CaptchaPreAuthenticationProvider in the test.
* Also bump required MW version to 1.37.0

Bug: T281993
Change-Id: I9a139433b089597a2a5dfb7e23338fc8f7183b47
2021-05-25 15:34:56 +00:00
libraryupgrader bef3c335b5 build: Updating composer dependencies
* mediawiki/mediawiki-codesniffer: 35.0.0 → 36.0.0
* php-parallel-lint/php-parallel-lint: 1.2.0 → 1.3.0

Change-Id: Ib16a714334088d26d3fbaa88b5c9395fa0ab67a5
2021-05-04 04:14:03 +00:00
Umherirrender 76ff299d8c Use MediaWikiServices::getAuthManager
This required MediaWiki 1.35 (already set in extension.json)

Change-Id: Ic640f25b299dd7be429766f028ec91ab9481c85c
2020-04-04 16:57:51 +02:00
Brad Jorsch 003237ce9c Fix test hooking of 'PingLimiter'
The code was setting $wgHooks['PingLimiter'] to a Closure rather than
an array of callables, which resulted in the hook never actually being
called.

Interesting that that didn't make any of the tests fail. Anyway, let's
switch to using the setTemporaryHook() method now provided by MW's base
test class.

Change-Id: I6ac22b3c43735dcab4920de827bf06e25f9adc04
2020-04-02 15:22:22 -04:00
mainframe98 e95765a45e Don't conditionally set ObjectCache::$instances
The service LocalClusterObjectCache (to be introduced
in I39b03b1078efde3d9bc721d9d0c3694988c53a67) is not yet available.
The change linked above introduces it, but still relies on ObjectCache
because of tests of other extensions. ConfirmEdit's tests therefore
should always set ObjectCache::$instances, regardless of the existance
of the LocalClusterObjectCache service.

Change-Id: Ide340b7295ebe63a4efcfe6ec4381eb6697f8335
2020-01-21 17:28:22 +00:00
Max Semenik 9380fa050e Stop passing objects by reference
Bug: T193950
Change-Id: I8c4aabe75ffce55f81c7ffb0f76b67155db1f761
2020-01-17 20:08:16 +00:00
Max Semenik 8b6b9aaa86 tests: getMock() is deprecated
Bug: T192167
Change-Id: I385dccbcda40c71201ce1f5553cb30dee53a6a33
2019-10-21 22:20:51 -07:00
James D. Forrester 86246f0172 build: Upgrade mediawiki-codesniffer to v28.0.0
Change-Id: I12c3660e74e42937f6cfb31ec4771a67d8651f42
2019-10-09 15:45:51 -07:00
Umherirrender f96b1eda5b Use ::class for class name resolution
Available since php5.5

Change-Id: I9b072c487b84e04fbb7e9ad8ed4b9db46d805ee8
2019-03-02 19:39:36 +01:00
Kunal Mehta e1f45829d4 Add @covers tags
Change-Id: I1e99261acb13c86e96c1b2dd1cb61918ebc660c2
2018-01-23 15:59:08 -08:00
Reedy 9efde84c36 Remove pre-authmanager code
Bug: T178026
Change-Id: I8604c95e4de28cc15a821bc2cc27a3e4b239d85e
2017-10-12 01:47:11 +01:00
Gergő Tisza 67a909fd8a Switch TestingAccessWrapper to librarized version
Bug: T163434
Change-Id: I7d262901f0ae66f20658516bad8aa2d8de3a40f7
Depends-On: I52cc257e593da3d6c3b01a909e554a950225aec8
2017-04-20 11:35:07 +00:00
Bryan Davis ed9886f6fd Set valid $wgRateLimits in tests
Change-Id: Iacdd1719d5f08eca91de0a35c0042ffee2136f34
2016-10-03 23:36:43 -06:00
Aaron Schulz 1cf32cf036 Reset the LocalClusterObjectCache service in tests
Change-Id: I0886e749dee19d729bcd4f398d65b78aa22a8065
2016-09-12 10:24:27 +00:00
Reedy 6a8c53f6d1 Remove 'UnitTestList' hook
No longer needed now that extension unittests are autodiscovered.

Bug: T142120
Bug: T142121
Change-Id: I7105170e56c8c3ec3837dd15be869e503bccecde
2016-08-05 18:46:15 +01:00
Renamed from tests/CaptchaPreAuthenticationProviderTest.php (Browse further)