Creating any block class includes a call to AbstractBlock::setTarget which uses MediaWikiServices, meaning that no blocks can be created in unit tests. If the target is an empty string '', set the target and type to null instead of using the BlockUtils service, which would eventually set them to null but would require using MediaWikiServices Allows moving SystemBlockTest to a unit test Change-Id: Icdf10a6b89aef1995b6e5b5cee9ba5dd5593b01e
21 lines
393 B
PHP
21 lines
393 B
PHP
<?php
|
|
|
|
use MediaWiki\Block\SystemBlock;
|
|
|
|
/**
|
|
* @group Blocking
|
|
* @coversDefaultClass \MediaWiki\Block\SystemBlock
|
|
*/
|
|
class SystemBlockTest extends MediaWikiUnitTestCase {
|
|
/**
|
|
* @covers ::getSystemBlockType
|
|
*/
|
|
public function testSystemBlockType() {
|
|
$block = new SystemBlock( [
|
|
'systemBlock' => 'proxy',
|
|
] );
|
|
|
|
$this->assertSame( 'proxy', $block->getSystemBlockType() );
|
|
}
|
|
|
|
}
|