Commit graph

22 commits

Author SHA1 Message Date
STran
311774c033 Filter temporary accounts as anonymous in ApiQueryRecentChanges
Edits from temporary accounts are considered anonymous edits.
ApiQueryRecentChanges doesn't correctly reflect this and needs to be
updated to correctly return temporary account edits as anonymous (and
similarly, not to return them when requesting !anon)

- Update the anon|!anon query to accomodate temporary accounts

Bug: T370803
Change-Id: Ica5225422ea53d2aa3a84b86d9c2f14832a34ed4
2024-07-29 11:00:22 +01:00
Kosta Harlan
059d155dd3 ApiQueryRecentChangesIntegrationTest: Fixes for temp accounts
Why:

- This test does not pass when temp accounts are enabled

What:

- Set disableAutoCreateTempUser when doing an anon page edit
- Set a valid pattern for the temp user name

This patch does not fix testUserPropParameter but does solve the other
failures for this class.

Bug: T365669
Change-Id: I24b3ff10c6275a9c13c3f07d97ea14581f975067
2024-06-26 10:55:32 +00:00
Ebrahim Byagowi
1e4f59b724 Add namespace and deprecation alias to WatchedItemQueryService
This patch introduces a namespace declaration for the
MediaWiki\Watchlist to WatchedItemQueryService and establishes a class
alias marked as deprecated since version 1.43.

Bug: T353458
Change-Id: Ib1b5c19c89087940987730939e84c8cd35cd3760
2024-05-18 01:50:29 +03:30
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
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
James D. Forrester
1d0b7ae1e2 Namespace User under \MediaWiki\User
Bug: T166010
Change-Id: I7257302b485588af31384d4f7fc8e30551f161f1
2023-09-19 19:18:16 +00:00
James D. Forrester
94ece673b2 Namespace TitleValue under \MediaWiki\Title
One of the big ones, so doing this alone.

Bug: T166010
Change-Id: I4c901d5c32696d8334ec30cede7d9b6f3d8d645e
2023-09-18 18:24:39 +01:00
jenkins-bot
59386e31a6 Merge "tests: api: Use NS_ constants instead of hard coded values" 2023-07-30 14:21:22 +00:00
Umherirrender
8f273a9dfa tests: api: Replace some static function with services
Replace User::, Title:: ContentHandler:: calls
to the corresponding services

Change-Id: I57e47221a00eafac9f171215019cf25e19e1808e
2023-07-29 11:58:54 +02:00
Umherirrender
d3fb83de20 tests: api: Use NS_ constants instead of hard coded values
Avoid some "magic" numbers

Change-Id: I52ec97434751cfe4136d504a3f8107c6bc63e7ab
2023-07-29 11:02:26 +02:00
James D. Forrester
ad06527fb4 Reorg: Namespace the Title class
This is moderately messy.

Process was principally:

* xargs rg --files-with-matches '^use Title;' | grep 'php$' | \
  xargs -P 1 -n 1 sed -i -z 's/use Title;/use MediaWiki\\Title\\Title;/1'
* rg --files-without-match 'MediaWiki\\Title\\Title;' . | grep 'php$' | \
  xargs rg --files-with-matches 'Title\b' | \
  xargs -P 1 -n 1 sed -i -z 's/\nuse /\nuse MediaWiki\\Title\\Title;\nuse /1'
* composer fix

Then manual fix-ups for a few files that don't have any use statements.

Bug: T166010
Follows-Up: Ia5d8cb759dc3bc9e9bbe217d0fb109e2f8c4101a
Change-Id: If8fc9d0d95fc1a114021e282a706fc3e7da3524b
2023-03-02 08:46:53 -05:00
Umherirrender
6555923b08 tests: Replace deprecated WikiPage::factory
Bug: T297688
Change-Id: Ic84d491c5603f3590e26cb56a305508b2b0ca109
2022-09-02 19:34:02 +00:00
Umherirrender
ef0623ec06 tests/api: Add TestUser::getAuthority and use it
Change-Id: Icfb66f9927c8e67582010a208538b0b5e0ba353f
2022-08-06 23:15:27 +02:00
Umherirrender
6a8f3b4c55 tests/api: Use MediaWikiIntegrationTestCase::editPage for edits
Also improve MediaWikiIntegrationTestCase::editPage by accepting
LinkTarget objects and use services instead of static functions

Change-Id: I3d036b0837f212d3500159c1d3a3daa4e706882c
2022-08-06 22:21:51 +02:00
Alexander Vorwerk
decbaf4f38 phpunit: use ->getServiceContainer() in integration tests
Change-Id: I38299cb65eeaadfdc0eb05db4e8c0b0119cfb37d
2022-01-27 22:04:16 +01:00
Daimona Eaytoy
2688c59606 tests: Replace usages of deprecated WikiPage::doDeleteArticleReal
Add a new helper to MediaWikiIntegrationTestCase, since deleting pages
seems to be pretty common in tests.

Some calls to WikiPage::factory were also updated to use WikiPageFactory.

Change-Id: I5b5100273a00ac292a1900022ca79708fa254347
2022-01-17 15:38:02 +00:00
DannyS712
b45ddb2ab3 Use WikiPage::doUserEditContent() instead of ::doEditContent()
Results in passing a user where previously the fallback
to $wgUser was being used, mostly in tests.

Bug: T255507
Change-Id: Iabe24315b23c0ad1272353186425e71974528d23
2021-06-28 00:11:30 -07:00
daniel
c7eca76241 RecentChange: replace Title in method signatures
Bug: T278459
Change-Id: I144ea130f29ec437302649d86494034af044c524
2021-04-26 17:48:02 +02:00
Aaron Schulz
815912062f Move ApiQuery* tests under the /query subdirectory
Consistency aside, this is useful for grouping more tests
into separate threads when using directory based suites.

Bug: T50217
Change-Id: Ife9acd5990c4ae4a5fc18371559e93d7d86fb57d
2020-10-30 03:31:12 +00:00
Renamed from tests/phpunit/includes/api/ApiQueryRecentChangesIntegrationTest.php (Browse further)