Test ApiDisabled.php
authorAryeh Gregor <ayg@aryeh.name>
Tue, 20 Mar 2018 16:01:07 +0000 (18:01 +0200)
committerAryeh Gregor <ayg@aryeh.name>
Tue, 20 Mar 2018 16:01:07 +0000 (18:01 +0200)
Locally this reports that everything is covered, although the get*()
functions are not registering at all (white backgrounds).

Change-Id: I73fabfb33b329dc3416368fda52d35f7ee6a4a18

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' ] );
+       }
+}