Commit graph

11 commits

Author SHA1 Message Date
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
daniel
fed7f0b179 Remove $actor field from UsererIdentityValue
Code that needs to store an actor ID in the database to
represent a UserIdentity, or needs to construct a UserIdentity based on
an actor ID loaded from the database, should use the ActorNormalization
service.

Note: The getActorId() method is removed from the UserIdentity interface,
but all concrete classes continue to support it for now.
UsererIdentityValue::getActorId() is hard deprecated and should
be removed in 1.37. It always returns 0.
User::getActorId() is not deprecated at this point.

Bug: T274179
Depends-On: Id2b3ddf6a2a7cdf90f8936a69148d2cce6fde237
Change-Id: I9925906d11e47efaec3c1f48d5cb3f9896a982c1
2021-04-13 18:18:06 +00:00
Umherirrender
a1de8b8700 Tests: Mark more more closures as static
Result of a new sniff I25a17fb22b6b669e817317a0f45051ae9c608208

Bug: T274036
Change-Id: I695873737167a75f0d94901fa40383a33984ca55
2021-02-09 02:55:57 +00:00
Umherirrender
f20c0ac8bb Remove incomplete @param from test function
the @dataProvider should be a enough here

Change-Id: I36549dcac027a68244de042d48d90d4070771be8
2021-02-01 20:19:22 +01:00
Petr Pchelko
10de1d3472 Introduce MockAuthorityTrait for Authority test helpers
Change-Id: I152f2cbe8a7000eedc237fb46b4e4c6d2f9730d4
2021-01-21 20:19:12 -06:00
Petr Pchelko
3a2e8883b4 Rest: use Authority in all core handlers
Bug: T239753
Change-Id: Idf2229255f49514dd8b68bf63573c5b619b4f2f1
2021-01-21 18:22:33 -06:00
Nikki Nikkhoui
5c9c1c5d7f Rename "name" to user in UserContributions
Rename path param "name" to user in UserContributions endpoints.
Name is more appropriate as "name" could be username as
well as IP address or range of IP addresses.
It also fits better with the implementation, as the
user parameter gets validated as a User object.

Bug: T259680
Change-Id: I6a146d99d1063c250f2ac460e4576bc287259766
2020-08-05 16:34:39 -07:00
Nikki Nikkhoui
3013ff9bdf Use UserDef in UserContribs endpoints
Change-Id: I9620e45ab1aa28dfa526705fce163ed5a27c4f86
2020-08-05 13:09:35 -07:00
Nikki Nikkhoui
3ba476102d /contributions/user/{user}/count
REST Endpoint for getting the number of contributions for a given
user (not yourself).

Change-Id: Ib3bfedcec0aa1af1983cec0a7bda28fc49ddc673
2020-07-28 18:36:41 +00:00
daniel
afdcacbfd5 REST /me/contributions/count filter by tag
Bug: T251806
Change-Id: Ib071ebb91f20a0ca1c0e14b4a271fc17f343a648
2020-07-06 19:56:17 +02:00
daniel
c1a73e64e1 REST me/contributions/count endpoint
Introduce endpoint for getting a uer's contribution count.

Bug: T251805
Change-Id: I409b7943941437f46dd8cdb2194fca9b7404f185
2020-07-06 09:28:33 +00:00