From: dcot Date: Thu, 2 Aug 2018 17:21:05 +0000 (-0400) Subject: Add PHPUnit test to ApiQueryDisabled X-Git-Tag: 1.34.0-rc.0~4474^2 X-Git-Url: https://git.cyclocoop.org/%20%27.%28%24debut%20%20%20%24par_page%29.%27?a=commitdiff_plain;h=1e01bf8a28f882f9a5b5414851c6ca3247fc8468;p=lhc%2Fweb%2Fwiklou.git Add PHPUnit test to ApiQueryDisabled This change adds a PHPUnit test to ApiQueryDisabled as requested in T183885. A PHPUnit test for ApiDisabled was already in place. Bug: T183885 Change-Id: I7726c27a5ca74ce26f095afd13af4a71babea82e --- diff --git a/tests/phpunit/includes/api/ApiQueryDisabledTest.php b/tests/phpunit/includes/api/ApiQueryDisabledTest.php new file mode 100644 index 0000000000..52f1fdf7e0 --- /dev/null +++ b/tests/phpunit/includes/api/ApiQueryDisabledTest.php @@ -0,0 +1,26 @@ +mergeMwGlobalArrayValue( 'wgAPIPropModules', + [ 'categories' => 'ApiQueryDisabled' ] ); + + $data = $this->doApiRequest( [ + 'action' => 'query', + 'prop' => 'categories', + ] ); + + $this->assertArrayHasKey( 'warnings', $data[0] ); + $this->assertArrayHasKey( 'categories', $data[0]['warnings'] ); + $this->assertArrayHasKey( 'warnings', $data[0]['warnings']['categories'] ); + + $this->assertEquals( 'The "categories" module has been disabled.', + $data[0]['warnings']['categories']['warnings'] ); + } +}