See full rationale at I59068cfed10aabf6c6002f9e9312a6ef6e7e9441.
Using IDatabase for now instead of DBConnRef for better BC.
Change-Id: Ie75aaf46ba91779e8706b10efeefa9580857f489
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
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
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
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