Debian Codegraph @

tests/phpunit/includes/api/query/ApiQueryDisabledTest.php

raw symbols SCIP
1 <?php
2
3 namespace MediaWiki\Tests\Api\Query;
4
5 use MediaWiki\Tests\Api\ApiTestCase;
6
7 /**
8 * @group API
9 * @group medium
10 *
11 * @covers MediaWiki\Api\ApiQueryDisabled
12 */
13 class ApiQueryDisabledTest extends ApiTestCase {
14 public function testDisabled() {
15 $this->mergeMwGlobalArrayValue( 'wgAPIPropModules',
16 [ 'categories' => 'ApiQueryDisabled' ] );
17
18 $data = $this->doApiRequest( [
19 'action' => 'query',
20 'prop' => 'categories',
21 ] );
22
23 $this->assertArrayHasKey( 'warnings', $data[0] );
24 $this->assertArrayHasKey( 'categories', $data[0]['warnings'] );
25 $this->assertArrayHasKey( 'warnings', $data[0]['warnings']['categories'] );
26
27 $this->assertEquals( 'The "categories" module has been disabled.',
28 $data[0]['warnings']['categories']['warnings'] );
29 }
30 }