Commit graph

13 commits

Author SHA1 Message Date
Reedy
2c0790333d tests: More use statements in auth tests
Change-Id: Ic57b19a779065a18112334d79ede395ced1a202b
2024-02-16 21:49:35 +00:00
Reedy
e94e265a93 tests: Add Tests to PHP namespacing
Change-Id: I849268172751d50292e93aa75abe8094873f56bc
2024-02-16 19:10:11 +00:00
Amir Sarabadani
2d66025fdf Drop deprecated configs $wgMinimalPasswordLength and $wgMaximalPasswordLength
Soft-deprecated since 1.26 and hard-deprecated since at least
I9776d11d4e2d184 (1.39).

Not set in production.

Change-Id: I55e4569c5a40f77a719bc7ab1924eaa706e0da53
2024-02-01 16:29:05 +01:00
Daimona Eaytoy
2668b94a5a Do not use UTSysop directly in auth tests
These tests are all making two assumptions:
- That the sysop test account exists
- That its name is UTSysop

Both assumptions happen to be true right now, but the first one will no
longer be after change I30861742. The second one will probably remain
true for a while, but still, tests shouldn't rely on this implementation
detail when possible.

If a test needs an exiting test user, it should call getTestUser /
getTestSysop.

Use mocks or different usernames where the user actually doesn't matter,
e.g. in non-Database tests where UTSysop already doesn't exist.

Bug: T342428
Change-Id: Ie77e72f5a5ee6a2ef4ec9dceaa9044bb690f68b2
2023-08-16 00:34:30 +00:00
mainframe98
7299aed7a5 tests: Allow overridable data providers to be static
This uses some reflection to identify if the data provider is static or
not. If it isn't, a deprecation notice is emitted. This doesn't fail the
tests, but is still printed in the output.

To facilitate this, the relevant abstract method has been uncommented,
as PHP does not like it when function signatures do not match up.

This approach means that tests in extensions or skins do not immediately
break when making data providers static. Instead, they can do so at
their own pace.

Bug: T332865
Change-Id: I5ff35ad0e894f0a27beae00257dc1fc599ad518d
2023-05-16 16:28:43 +01:00
Umherirrender
bbaa4c25d9 tests: Use MainConfigNames constants on overrideConfigValue
Change-Id: Ieeefb88daf55a976883f6e20ef6881c89a7f7630
2022-07-12 19:34:54 +02:00
daniel
033060bbaa PHPUnit: introduce overrideConfigValues.
overrideConfigValues() is introduced as a replacement for
setMwGlobals(). Since we are moving away from reading configuration
from global variables, test cases should not use global variables to set
configuration.

Bug: T294739
Change-Id: I9d41045bd13932bd853f53e00322233fc4f1321c
2022-06-21 13:29:29 +02:00
Daimona Eaytoy
6365eaab8d Autofix 94 PHPUnit 8 compat issues
Done automatically using the master version of MW codesniffer and
running composer fix.

Bug: T192167
Change-Id: If6b40f515fde32ab5eff074a90e821c30c791827
2019-12-13 15:29:10 +01:00
Gergő Tisza
ad4e22cedb
Fix password policy handling in temporary password provider
Fix breakage caused by f15ecc60cd. Also use correct check name.

Bug: T216196
Change-Id: Id2567adf8334742ef18a59a6c7e74b2b780ab43a
2019-02-20 12:25:49 -08:00
Alangi Derick
b86593a2da Fix undefined NS with @covers tags in /includes/auth/
Should MW Codesniffer also handle these as well?

Change-Id: Ieb493bddd5f3674fb889b4a780d51b50d89c4f65
2018-11-01 12:48:52 +01:00
Aryeh Gregor
09eee138e1 Deprecate MediaWikiTestCase::stashMwGlobals
This method encourages directly editing configuration variables.  It's a
better idea to use setMwGlobals() (or other set wrappers) so that we can
be intelligent in the future, for instance resetting services after the
config change.  Plus, a lot of the callers come out cleaner this way
anyway.

Depends-On: I8a1e81acc5c42a8d7f30938a72cface0acea4a70
Depends-On: I4105dbcf9c5399fe7239478c460ec57c015a98d4
Depends-On: I1b220996acf2f66cf7b0f092b341584663df32f9
Depends-On: Ie2d1ea65c0cb334bbde1666d00781474b7ac4dab
Change-Id: I23d77398e401f4986b1d5bd1c9e11a8a40da16f8
2018-10-07 19:39:47 +03:00
Umherirrender
45da581551 Use ::class to resolve class names in tests
This helps to find renamed or misspelled classes earlier.
Phan will check the class names

Change-Id: Ie541a7baae10ab6f5c13f95ac2ff6598b8f8950c
2018-01-26 22:49:13 +01:00
Brad Jorsch
d245bd25ae Add AuthManager
This implements the AuthManager class and its needed interfaces and
subclasses, and integrates them into the backend portion of MediaWiki.
Integration with frontend portions of MediaWiki (e.g. ApiLogin,
Special:Login) is left for a followup.

Bug: T91699
Bug: T71589
Bug: T111299
Co-Authored-By: Gergő Tisza <gtisza@wikimedia.org>
Change-Id: If89d24838e326fe25fe867d02181eebcfbb0e196
2016-05-16 15:11:02 +00:00