Commit graph

7 commits

Author SHA1 Message Date
DannyS712
297d5a15c2 user: Remove support for UserIdentity audience from UserNamePrefixSearch
Change-Id: Ifa4e9b34bdeb1a0ff44de2426078544ec00b49c2
2022-03-25 01:11:39 +00:00
Daimona Eaytoy
613a874635 rdbms: Add more return typehints
See full rationale at I59068cfed10aabf6c6002f9e9312a6ef6e7e9441.
Using IDatabase for now instead of DBConnRef for better BC.

Change-Id: Ie75aaf46ba91779e8706b10efeefa9580857f489
2021-09-07 08:23:36 +00:00
DannyS712
91ac8a717d Add UserNameUtils to DummyServicesTrait, and use it
Allows us to reduce direct mocking in individual tests, or relying
on MediaWikiServices, by having a reusable service instead that
can be used in unit tests.

Make use of it in a few places.

This dummy service is also less coupled to individual tests;
in the rest handler tests, replacing mocks that report that
only a specific string is an ip address with the actual implementation
that accepts other ip address, and in BlockUtilsTest use
an actually invalid user name instead of making the mock
UserNameUtils complain about a perfectly valid name.

Change-Id: Iaa3195002ac4ae7e0c9c58ed57c80c02762d4070
2021-07-27 12:17:06 +00:00
DannyS712
b92463763d UserNamePrefixSearch: use UserNameUtils instead of UserFactory
Rather than having UserFactory create a User object based on a name,
to then get the name of that user, use UserNameUtils::getCanonical()

Follow-up: Ib78b9bdc96c935d75bd03a8af789b8b359c58b07
Change-Id: I52b31749b5fdccfe7102be49af78d080629d213c
2021-06-28 07:48:56 +00:00
DannyS712
19d869e615 Migrate UserNamePrefixSearch service to use Authority
Change-Id: I43f9c80a3b782b1263ec4dc70d67696f6b1476d7
2021-05-26 05:35:32 +00:00
Thiemo Kreuz
c1ee8250e9 Remove unnecessary ->equalTo() from tests
This is the default anyway when using ->with(). The test code
becomes so much more readable without this, I would like to
argue. Let it just say "with these values".

Because of the way I split my changes into multiple patches
there are a few other changes in this patch I could not split,
e.g. removing unnecessary ->any(). This is the default anyway
and doesn't make the test more specific.

Change-Id: I34990799fa9258ba8dc64c7e78ec43f7903b7681
2021-04-23 12:02:42 +02:00
DannyS712
1f1793dc06 Convert UserNamePrefixSearch to a service
Replace existing class with static ::search method
with a service under MediaWiki\User\ and with
dependencies injected

Similar to the creation of the SpecialPageFactory
service, rename the old file to UserNamePrefixSearch_deprecated
so that UserNamePrefixSearch.php can be used for
the service.

Follow-up patches will:
* Inject and use the new service
* Update the release notes
* Replace the use of the UserFactory with UserNameUtils

Change-Id: Ib78b9bdc96c935d75bd03a8af789b8b359c58b07
2020-10-08 00:14:41 +00:00