registration: Add test to check extension.json globals are documented
authorKunal Mehta <legoktm@member.fsf.org>
Fri, 10 Jun 2016 20:11:01 +0000 (13:11 -0700)
committerJforrester <jforrester@wikimedia.org>
Fri, 15 Jul 2016 16:42:55 +0000 (16:42 +0000)
Verify that all the global settings listed in
ExtensionProcessor::$globalSettings are documented in the extension.json
schema.

Change-Id: If0ed09ed19b92934e869bbd40d8716a83e4b0a30

tests/phpunit/includes/registration/ExtensionProcessorTest.php

index 0120d79..ea86535 100644 (file)
@@ -414,6 +414,26 @@ class ExtensionProcessorTest extends MediaWikiTestCase {
                        ]
                ];
        }
+
+       public function testGlobalSettingsDocumentedInSchema() {
+               global $IP;
+               $globalSettings = TestingAccessWrapper::newFromClass(
+                       ExtensionProcessor::class )->globalSettings;
+
+               $schema = FormatJson::decode(
+                       file_get_contents( "$IP/docs/extension.schema.json" ),
+                       true
+               );
+               $missing = [];
+               foreach ( $globalSettings as $global ) {
+                       if ( !isset( $schema['properties'][$global] ) ) {
+                               $missing[] = $global;
+                       }
+               }
+
+               $this->assertEquals( [], $missing,
+                       "The following global settings are not documented in docs/extension.schema.json" );
+       }
 }
 
 /**