From ee71c2658eb8388039248010bfc99b0ca90d5c34 Mon Sep 17 00:00:00 2001 From: Kunal Mehta Date: Fri, 10 Jun 2016 13:11:01 -0700 Subject: [PATCH] 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 --- .../registration/ExtensionProcessorTest.php | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) 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" ); + } } /** -- 2.20.1