3 use MediaWiki\Block\DatabaseBlockStore
;
4 use MediaWiki\Tests\Maintenance\MaintenanceBaseTestCase
;
7 * @covers \PurgeExpiredBlocks
10 class PurgeExpiredBlocksTest
extends MaintenanceBaseTestCase
{
11 public function getMaintenanceClass() {
12 return PurgeExpiredBlocks
::class;
15 public function testExecute() {
16 // Mock the DatabaseBlockStore to expect that ::purgeExpiredBlocks is called once.
17 $mockDatabaseBlockStore = $this->createMock( DatabaseBlockStore
::class );
18 $mockDatabaseBlockStore->expects( $this->once() )
19 ->method( 'purgeExpiredBlocks' );
20 $this->setService( 'DatabaseBlockStore', $mockDatabaseBlockStore );
21 $this->maintenance
->execute();
22 $this->expectOutputRegex( '/Purging expired blocks/' );