From: Kunal Mehta Date: Fri, 10 Jun 2016 20:11:01 +0000 (-0700) Subject: registration: Add test to check extension.json globals are documented X-Git-Tag: 1.31.0-rc.0~6365 X-Git-Url: http://git.cyclocoop.org/%22%20.%20generer_url_ecrire%28%22suivi_revisions%22%29%20.%20%22?a=commitdiff_plain;h=ee71c2658eb8388039248010bfc99b0ca90d5c34;p=lhc%2Fweb%2Fwiklou.git registration: Add test to check extension.json globals are documented Verify that all the global settings listed in ExtensionProcessor::$globalSettings are documented in the extension.json schema. Change-Id: If0ed09ed19b92934e869bbd40d8716a83e4b0a30 --- diff --git a/tests/phpunit/includes/registration/ExtensionProcessorTest.php b/tests/phpunit/includes/registration/ExtensionProcessorTest.php index 0120d79ec5..ea865351fa 100644 --- a/tests/phpunit/includes/registration/ExtensionProcessorTest.php +++ b/tests/phpunit/includes/registration/ExtensionProcessorTest.php @@ -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" ); + } } /**