From 1e01bf8a28f882f9a5b5414851c6ca3247fc8468 Mon Sep 17 00:00:00 2001 From: dcot Date: Thu, 2 Aug 2018 13:21:05 -0400 Subject: [PATCH] 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 --- .../includes/api/ApiQueryDisabledTest.php | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 tests/phpunit/includes/api/ApiQueryDisabledTest.php 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'] ); + } +} -- 2.20.1