Restore ApiQueryUserInfo::getBlockInfo() as a stub.
[lhc/web/wiklou.git] / tests / phpunit / includes / api / ApiQueryUserInfoTest.php
1 <?php
2
3 /**
4 * @group medium
5 * @covers ApiQueryUserInfo
6 */
7 class ApiQueryUserInfoTest extends ApiTestCase {
8 public function testGetBlockInfo() {
9 $this->hideDeprecated( 'ApiQueryUserInfo::getBlockInfo' );
10
11 $apiQueryUserInfo = new ApiQueryUserInfo(
12 new ApiQuery( new ApiMain( $this->apiContext ), 'userinfo' ),
13 'userinfo'
14 );
15
16 $block = new Block();
17 $info = $apiQueryUserInfo->getBlockInfo( $block );
18 $subset = [
19 'blockid' => null,
20 'blockedby' => '',
21 'blockedbyid' => 0,
22 'blockreason' => '',
23 'blockexpiry' => 'infinite',
24 'blockpartial' => false,
25 ];
26 $this->assertArraySubset( $subset, $info );
27 }
28
29 public function testGetBlockInfoPartial() {
30 $this->hideDeprecated( 'ApiQueryUserInfo::getBlockInfo' );
31
32 $apiQueryUserInfo = new ApiQueryUserInfo(
33 new ApiQuery( new ApiMain( $this->apiContext ), 'userinfo' ),
34 'userinfo'
35 );
36
37 $block = new Block( [
38 'sitewide' => false,
39 ] );
40 $info = $apiQueryUserInfo->getBlockInfo( $block );
41 $subset = [
42 'blockid' => null,
43 'blockedby' => '',
44 'blockedbyid' => 0,
45 'blockreason' => '',
46 'blockexpiry' => 'infinite',
47 'blockpartial' => true,
48 ];
49 $this->assertArraySubset( $subset, $info );
50 }
51 }