Page MenuHomeWickedGov Phorge

CheckUsernamesTest.php
No OneTemporary

Size
977 B
Referenced Files
None
Subscribers
None

CheckUsernamesTest.php

<?php
namespace MediaWiki\Tests\Maintenance;
use CheckUsernames;
use MediaWiki\MainConfigNames;
use TestUser;
/**
* @covers \CheckUsernames
* @group Database
*/
class CheckUsernamesTest extends MaintenanceBaseTestCase {
protected function getMaintenanceClass() {
return CheckUsernames::class;
}
public function testExecute() {
$testUser1 = ( new TestUser( "TestUser 1234" ) )->getUserIdentity();
$testUser2 = ( new TestUser( "TestUser 4321" ) )->getUserIdentity();
// Set wgMaxNameChars to 2 so that both users fail to be valid.
$this->overrideConfigValue( MainConfigNames::MaxNameChars, 2 );
// Set the batch size to 1 to test multiple batches (as there are two users)
$this->maintenance->setOption( 'batch-size', 1 );
$this->maintenance->execute();
$this->expectOutputString(
sprintf( "Found: %6d: '%s'\n", $testUser1->getId(), $testUser1->getName() ) .
sprintf( "Found: %6d: '%s'\n", $testUser2->getId(), $testUser2->getName() )
);
}
}

File Metadata

Mime Type
text/x-php
Expires
Aug 19 2026, 18:58 (6 w, 4 d ago)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
ca/00/fcf8f7de867a31d5f9a4dd3d79bd
Default Alt Text
CheckUsernamesTest.php (977 B)

Event Timeline