UserTest has a private method for enabling temporary accounts:
private function enableAutoCreateTempUser() { $this->overrideConfigValue( MainConfigNames::AutoCreateTempUser, [ 'enabled' => true, 'expireAfterDays' => null, 'actions' => [ 'edit' ], 'genPattern' => '*Unregistered $1', 'matchPattern' => '*$1', 'serialProvider' => [ 'type' => 'local' ], 'serialMapping' => [ 'type' => 'plain-numeric' ], ] ); }
Setting all those defaults can get quite repetitive across tests, so it could be helpful to have a trait that does this.
Other tests that enable temporary accounts: https://codesearch.wmcloud.org/search/?q=AutoCreateTempUser&files=.*Test.php&excludeFiles=&repos=