This commit splits the existing Block class into AbstractBlock, Block and SystemBlock. Before this patch, the Block class represents several types of blocks, which can be separated into blocks stored in the database, and temporary blocks created by the system. These are now represented by Block and SystemBlock, which inherit from AbstractBlock. This lays the foundations for: * enforcing block parameters from multiple blocks that apply to a user/IP address * improvements to the Block API, including the addition of services Breaking changes: functions expecting a Block object should still expect a Block object if it came from the database, but other functions may now need to expect an AbstractBlock or SystemBlock object. (Note that an alternative naming scheme, in which the abstract class is called Block and the subclasses are DatabaseBlock and SystemBlock, avoids this breakage. However, it introduces more breakages to calls to static Block methods and new Block instantiations.) Changes to tests: system blocks don't set the $blockCreateAccount or $mExipry block properties, so remove/change any tests that assume they do. Bug: T222737 Change-Id: I83bceb5e5049e254c90ace060f8f8fad44696c67
21 lines
393 B
PHP
21 lines
393 B
PHP
<?php
|
|
|
|
use MediaWiki\Block\SystemBlock;
|
|
|
|
/**
|
|
* @group Blocking
|
|
* @coversDefaultClass \MediaWiki\Block\SystemBlock
|
|
*/
|
|
class SystemBlockTest extends MediaWikiLangTestCase {
|
|
/**
|
|
* @covers ::getSystemBlockType
|
|
*/
|
|
public function testSystemBlockType() {
|
|
$block = new SystemBlock( [
|
|
'systemBlock' => 'proxy',
|
|
] );
|
|
|
|
$this->assertSame( 'proxy', $block->getSystemBlockType() );
|
|
}
|
|
|
|
}
|