Keep Block as a deprecated class alias for DatabaseBlock. Update calls to the Block constructor and Block static methods from external classes. Also update documentation in several places that refer to blocks as Blocks. Bug: T222737 Change-Id: I6d96b63ca0a84bee19486471e0a16a53a79d768a
53 lines
1.2 KiB
PHP
53 lines
1.2 KiB
PHP
<?php
|
|
|
|
use MediaWiki\Block\DatabaseBlock;
|
|
|
|
/**
|
|
* @group medium
|
|
* @covers ApiQueryUserInfo
|
|
*/
|
|
class ApiQueryUserInfoTest extends ApiTestCase {
|
|
public function testGetBlockInfo() {
|
|
$this->hideDeprecated( 'ApiQueryUserInfo::getBlockInfo' );
|
|
|
|
$apiQueryUserInfo = new ApiQueryUserInfo(
|
|
new ApiQuery( new ApiMain( $this->apiContext ), 'userinfo' ),
|
|
'userinfo'
|
|
);
|
|
|
|
$block = new DatabaseBlock();
|
|
$info = $apiQueryUserInfo->getBlockInfo( $block );
|
|
$subset = [
|
|
'blockid' => null,
|
|
'blockedby' => '',
|
|
'blockedbyid' => 0,
|
|
'blockreason' => '',
|
|
'blockexpiry' => 'infinite',
|
|
'blockpartial' => false,
|
|
];
|
|
$this->assertArraySubset( $subset, $info );
|
|
}
|
|
|
|
public function testGetBlockInfoPartial() {
|
|
$this->hideDeprecated( 'ApiQueryUserInfo::getBlockInfo' );
|
|
|
|
$apiQueryUserInfo = new ApiQueryUserInfo(
|
|
new ApiQuery( new ApiMain( $this->apiContext ), 'userinfo' ),
|
|
'userinfo'
|
|
);
|
|
|
|
$block = new DatabaseBlock( [
|
|
'sitewide' => false,
|
|
] );
|
|
$info = $apiQueryUserInfo->getBlockInfo( $block );
|
|
$subset = [
|
|
'blockid' => null,
|
|
'blockedby' => '',
|
|
'blockedbyid' => 0,
|
|
'blockreason' => '',
|
|
'blockexpiry' => 'infinite',
|
|
'blockpartial' => true,
|
|
];
|
|
$this->assertArraySubset( $subset, $info );
|
|
}
|
|
}
|