wiki.techinc.nl/tests/phpunit/unit/includes/block/SystemBlockTest.php
DannyS712 57094675fc AbstractBlock::setTarget() don't always use MediaWikiServices
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
2021-03-30 16:24:10 +00:00

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() );
}
}