Localisation updates from https://translatewiki.net.
[mediawiki.git] / tests / phpunit / maintenance / CheckUsernamesTest.php
blobfebcff026e511df734f7e47c56f76bc21c288ccc
1 <?php
3 namespace MediaWiki\Tests\Maintenance;
5 use CheckUsernames;
6 use MediaWiki\MainConfigNames;
7 use TestUser;
9 /**
10 * @covers \CheckUsernames
11 * @group Database
13 class CheckUsernamesTest extends MaintenanceBaseTestCase {
15 protected function getMaintenanceClass() {
16 return CheckUsernames::class;
19 public function testExecute() {
20 $testUser1 = ( new TestUser( "TestUser 1234" ) )->getUserIdentity();
21 $testUser2 = ( new TestUser( "TestUser 4321" ) )->getUserIdentity();
22 // Set wgMaxNameChars to 2 so that both users fail to be valid.
23 $this->overrideConfigValue( MainConfigNames::MaxNameChars, 2 );
24 // Set the batch size to 1 to test multiple batches (as there are two users)
25 $this->maintenance->setOption( 'batch-size', 1 );
26 $this->maintenance->execute();
27 $this->expectOutputString(
28 sprintf( "Found: %6d: '%s'\n", $testUser1->getId(), $testUser1->getName() ) .
29 sprintf( "Found: %6d: '%s'\n", $testUser2->getId(), $testUser2->getName() )