Commit graph

14 commits

Author SHA1 Message Date
Wandji69
c257e2276c Replace db with getDb for Tests
Bug: T316841
Change-Id: I29e535e8ee9b5641a4546d53b98cd5060d39681d
2024-06-23 23:47:56 +01:00
Kosta Harlan
6efd008f33 TempAccounts: Rate limit acquisition of temp account names
Why:

- We don't want to allow unlimited acquisition of temp account names.
  These should be rate limited in similar way to how we limit the
  creation of temp accounts

What:

- Provide a TempAccountNameAcquisitionThrottle, and use it in the
  acquireName() method
- Set a default that is 10 times the limit of
  TempAccountNameCreationThrottle

Depends-On: If660aad1d0f04f366414084aff3f88484a19d416
Bug: T343101
Change-Id: I99d5973498a89ac227847de5837c0a8e895c28fb
2024-04-23 13:33:57 +00:00
Umherirrender
a89a00ffb8 tests: Migrate to IDatabase::newInsertQueryBuilder
Changed some inserts to use multi-row insert for small performance
benefit where possible and not already used.
InsertQueryBuilder does not return a value, deprecated since 1.33

Bug: T353219
Change-Id: I2380ebc8ec8db178dd790247aefbdd798b6d62ff
2024-04-14 21:56:07 +02:00
Dreamy Jazz
102424bfb3 Update wgAutoCreateTempUser config defaults
Why:
* The default value of wgAutoCreateTempUser has not changed since
  the decision to use a different prefix for temporary accounts
  (T332805).
* The default needs to be updated to reduce the number of overrides
  in operations/mediawiki-config and also to make the development
  experience more consistent with what is happening on WMF
  production.

What:
* Update the wgAutoCreateTempUser default in the following ways:
** Set expireAfterDays as 365
** Set notifyBeforeExpirationDays as 10
** Set genPattern and reservedPattern to '~$1'
** Set matchPattern to null, which will mean that the genPattern
   is used as the value.
* Update RealTempUserConfig::getPlaceholderName to add the year to
  the placeholder name so that if the match pattern includes the
  first digit of the year, then the placeholder name still is
  considered a valid temporary account username.
* Replace modifications of the wgAutoCreateTempUser config in
  integration tests with a use of the TempUserTestTrait to make
  the code cleaner and make it easier to find tests that relies on
  the values in wgAutoCreateTempUser.
* Update multiple tests to handle the new defaults for the config.

Bug: T359335
Change-Id: Ifa5a0123cd915bdb7c87e473c51fb93321622f12
2024-04-03 16:25:47 +00:00
Reedy
75640200fb tests: Namespace api tests
Bug: T357823
Change-Id: I0d7cc2c9b166d5e5b913c1305f7cee017fe377af
2024-02-18 15:47:04 +00:00
Reedy
85396a9c99 tests: Fix @covers and @coversDefaultClass to have leading \
Change-Id: I5629f91387f2ac453ee4341bfe4bba310bd52f03
2024-02-16 22:43:56 +00:00
Umherirrender
0e6113845e tests: Fix name of class property in ApiQueryImageInfoTest
Creation of dynamic property ApiQueryImageInfoTest::$tempUser is
deprecated in php8.2

Follow-Up: I7986dea5ccd0dc942bf133040c4ac715487f29b9
Change-Id: Ifa2b1fc46a30edb12266d46b71d8916c53397cc0
2023-12-13 20:01:39 +01:00
STran
c668caa5ce Add temp flags to api calls
Temporary accounts are now distinct from users or anonymous.
Add a flag to reflect that to:
  - ApiQueryImageInfo
  - ApiQueryLogEvents
  - ApiQueryRecentChanges
  - ApiQueryRevisionsBase

Bug: T351636
Change-Id: I7986dea5ccd0dc942bf133040c4ac715487f29b9
2023-12-12 00:32:01 -08:00
James D. Forrester
4ed5ca48b1 Follow-up 71ff05267: Stop writing to tablesUsed in tests, now unnecessary
Bug: T342301
Change-Id: I5ea01f7ee103570165261bde0965c5b65e04c369
2023-11-21 09:02:48 -05:00
Amir Sarabadani
15a278189f Reorg: Move MWTimestamp to MediaWiki\Utils
Bug: T321882
Change-Id: I48c10343295c4eb3d9ef8037343b0070e928f040
2023-08-19 05:53:40 +02:00
daniel
c6ca5baa16 phpunit: improve isolation by calling User::clearInstanceCache
User objects may hold references to service objects. They need to be
reset when services are reset between and during tests.

Change-Id: I7fe767977f1fe01d508fddf7a92ade3ec8ba2662
2022-12-04 15:21:30 +01:00
Umherirrender
ef0623ec06 tests/api: Add TestUser::getAuthority and use it
Change-Id: Icfb66f9927c8e67582010a208538b0b5e0ba353f
2022-08-06 23:15:27 +02:00
Petr Pchelko
392d2af20c ApiQueryImageInfo: don't show empty comments as deleted
Bug: T293783
Change-Id: Icddd06c7171bc1d1dba14ec7d6703e082b87836a
2021-10-26 11:36:09 -07:00
Petr Pchelko
67642b4a75 Add tests for ApiQueryImageInfo
Change-Id: Ib31b659fc72362e942c29c8bd14a19a6ee9383d2
2021-06-01 13:22:02 -07:00