Merge "Test ApiDisabled.php"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Wed, 21 Mar 2018 17:04:20 +0000 (17:04 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Wed, 21 Mar 2018 17:04:20 +0000 (17:04 +0000)
tests/phpunit/includes/api/ApiDisabledTest.php [new file with mode: 0644]

diff --git a/tests/phpunit/includes/api/ApiDisabledTest.php b/tests/phpunit/includes/api/ApiDisabledTest.php
new file mode 100644 (file)
index 0000000..cfdd57b
--- /dev/null
@@ -0,0 +1,19 @@
+<?php
+
+/**
+ * @group API
+ * @group medium
+ *
+ * @covers ApiDisabled
+ */
+class ApiDisabledTest extends ApiTestCase {
+       public function testDisabled() {
+               $this->mergeMwGlobalArrayValue( 'wgAPIModules',
+                       [ 'login' => 'ApiDisabled' ] );
+
+               $this->setExpectedException( ApiUsageException::class,
+                       'The "login" module has been disabled.' );
+
+               $this->doApiRequest( [ 'action' => 'login' ] );
+       }
+}