wiki.techinc.nl/tests/phpunit/includes/api/ApiQueryUserInfoTest.php
daniel 9f973228d5 Restore ApiQueryUserInfo::getBlockInfo() as a stub.
Fixes unintended breaking change made by I84ed21641c44b2f65ebe.
ApiQueryUserInfo::getBlockInfo() is restoed as a hard deprecated stub.

This renames the method in the new ApiBlockInfoTrait to
getBlockDetails.

Depends-On: I9f40666a31bd4af50762c197c2ce5bf089a5e68c
Change-Id: If47a93878f87d69800e5f305404c22528dac5e94
2019-05-11 07:33:25 +00:00

51 lines
1.2 KiB
PHP

<?php
/**
* @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 Block();
$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 Block( [
'sitewide' => false,
] );
$info = $apiQueryUserInfo->getBlockInfo( $block );
$subset = [
'blockid' => null,
'blockedby' => '',
'blockedbyid' => 0,
'blockreason' => '',
'blockexpiry' => 'infinite',
'blockpartial' => true,
];
$this->assertArraySubset( $subset, $info );
}
}