The ApiQueryBlocks and ApiQueryUserinfo endpoints will now return whether or not the block is sitewide or partial. Partial block restrictions can be returned with ApiQueryBlocks. Bug: T197141 Change-Id: I76eb4cac4dc989c621a00a39996faebd0eb9892c
47 lines
1 KiB
PHP
47 lines
1 KiB
PHP
<?php
|
|
|
|
/**
|
|
* @group medium
|
|
* @covers ApiQueryUserInfo
|
|
*/
|
|
class ApiQueryUserInfoTest extends ApiTestCase {
|
|
public function testGetBlockInfo() {
|
|
$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() {
|
|
$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 );
|
|
}
|
|
}
|