diff options
author | Dreamy Jazz <wpgbrown@wikimedia.org> | 2024-03-26 15:04:36 +0000 |
---|---|---|
committer | Dreamy Jazz <dreamyjazzwikipedia@gmail.com> | 2024-04-03 16:25:47 +0000 |
commit | 102424bfb31825a46f8a6ba5bd21ff8f76938046 (patch) | |
tree | 56af6b516ef166ece50ab4120dc045e1fb0a28b2 /tests/phpunit/includes/api/query/ApiQueryRecentChangesIntegrationTest.php | |
parent | f421c2786190dc83146daf62bafac3ab63fa62c3 (diff) | |
download | mediawikicore-102424bfb31825a46f8a6ba5bd21ff8f76938046.tar.gz mediawikicore-102424bfb31825a46f8a6ba5bd21ff8f76938046.zip |
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
Diffstat (limited to 'tests/phpunit/includes/api/query/ApiQueryRecentChangesIntegrationTest.php')
-rw-r--r-- | tests/phpunit/includes/api/query/ApiQueryRecentChangesIntegrationTest.php | 20 |
1 files changed, 5 insertions, 15 deletions
diff --git a/tests/phpunit/includes/api/query/ApiQueryRecentChangesIntegrationTest.php b/tests/phpunit/includes/api/query/ApiQueryRecentChangesIntegrationTest.php index 4269b55930bf..8a65c29a2e46 100644 --- a/tests/phpunit/includes/api/query/ApiQueryRecentChangesIntegrationTest.php +++ b/tests/phpunit/includes/api/query/ApiQueryRecentChangesIntegrationTest.php @@ -3,9 +3,9 @@ namespace MediaWiki\Tests\Api\Query; use MediaWiki\Linker\LinkTarget; -use MediaWiki\MainConfigNames; use MediaWiki\Permissions\Authority; use MediaWiki\Tests\Api\ApiTestCase; +use MediaWiki\Tests\User\TempUser\TempUserTestTrait; use MediaWiki\Title\TitleValue; use MediaWiki\User\User; use MediaWiki\User\UserIdentityValue; @@ -20,6 +20,7 @@ use WatchedItemQueryService; * @covers \ApiQueryRecentChanges */ class ApiQueryRecentChangesIntegrationTest extends ApiTestCase { + use TempUserTestTrait; private function getLoggedInTestUser() { return $this->getTestUser()->getUser(); @@ -68,24 +69,13 @@ class ApiQueryRecentChangesIntegrationTest extends ApiTestCase { private function doTempPageEdit( LinkTarget $target, $summary ) { // Set up temp user config - $this->overrideConfigValue( - MainConfigNames::AutoCreateTempUser, - [ - 'enabled' => true, - 'expireAfterDays' => null, - 'actions' => [ 'edit' ], - 'genPattern' => '*Unregistered $1', - 'matchPattern' => '*$1', - 'serialProvider' => [ 'type' => 'local' ], - 'serialMapping' => [ 'type' => 'plain-numeric' ], - ] - ); + $this->enableAutoCreateTempUser(); $page = $this->getServiceContainer()->getWikiPageFactory()->newFromLinkTarget( $target ); $page->doUserEditContent( $page->getContentHandler()->unserializeContent( __CLASS__ ), $this->getServiceContainer() ->getUserFactory() - ->newFromUserIdentity( new UserIdentityValue( 123456, '*Unregistered 1' ) ), + ->newFromUserIdentity( new UserIdentityValue( 123456, '~1' ) ), $summary ); } @@ -320,7 +310,7 @@ class ApiQueryRecentChangesIntegrationTest extends ApiTestCase { [ 'type' => 'new', 'temp' => true, - 'user' => '*Unregistered 1', + 'user' => '~1', ], [ 'type' => 'new', |