jenkins-bot has submitted this change and it was merged.
Change subject: Extend testNewFromGlobals test
......................................................................
Extend testNewFromGlobals test
Change-Id: I54e6857c80f6f136ea1b84fd54709a972436c8ed
---
M SemanticMediaWiki.hooks.php
M includes/Settings.php
M tests/phpunit/includes/SettingsTest.php
3 files changed, 38 insertions(+), 17 deletions(-)
Approvals:
Mwjames: Looks good to me, approved
jenkins-bot: Verified
diff --git a/SemanticMediaWiki.hooks.php b/SemanticMediaWiki.hooks.php
index 86a2b9a..25b1c85 100644
--- a/SemanticMediaWiki.hooks.php
+++ b/SemanticMediaWiki.hooks.php
@@ -278,6 +278,7 @@
'Infolink',
'QueryProcessor',
'Hooks',
+ 'Settings',
'dataitems/DI_Blob',
'dataitems/DI_Bool',
diff --git a/includes/Settings.php b/includes/Settings.php
index cd87685..c000102 100644
--- a/includes/Settings.php
+++ b/includes/Settings.php
@@ -78,11 +78,6 @@
* @return Settings
*/
public static function newFromGlobals() {
- // Collect all individual smwg* settings here
- // $settings = array_intersect_key( $GLOBALS,
- // array_flip( preg_grep('/^smwg/', array_keys( $GLOBALS )
) )
- //);
-
$settings = array(
'smwgScriptPath' => $GLOBALS['smwgScriptPath'],
'smwgIP' => $GLOBALS['smwgIP'],
@@ -149,6 +144,12 @@
'smwgCacheType' => $GLOBALS['smwgCacheType'],
'smwgAutoRefreshOnPurge' =>
$GLOBALS['smwgAutoRefreshOnPurge'],
'smwgAutoRefreshOnPageMove' =>
$GLOBALS['smwgAutoRefreshOnPageMove'],
+ 'smwgContLang' => $GLOBALS['smwgContLang'],
+ 'smwgMaxPropertyValues' =>
$GLOBALS['smwgMaxPropertyValues'],
+ 'smwgQSubpropertyDepth' =>
$GLOBALS['smwgQSubpropertyDepth'],
+ 'smwgNamespace' => $GLOBALS['smwgNamespace'],
+ 'smwgMasterStore' => $GLOBALS['smwgMasterStore'],
+ 'smwgIQRunningNumber' =>
$GLOBALS['smwgIQRunningNumber'],
);
return self::newFromArray( $settings );
diff --git a/tests/phpunit/includes/SettingsTest.php
b/tests/phpunit/includes/SettingsTest.php
index bfe8648..3b829eb 100644
--- a/tests/phpunit/includes/SettingsTest.php
+++ b/tests/phpunit/includes/SettingsTest.php
@@ -54,13 +54,13 @@
*/
public function dataSettingsProvider() {
// Using $this->arrayWrap( $settingArrays ) crashed PHP on
Windows
- return array( array(
- array(),
- array( 'foo' => 'bar' ),
- array( 'foo' => 'bar', 'baz' => 'BAH' ),
- array( 'bar' => array( '9001' ) ),
- array( '~[,,_,,]:3' => array( 9001, 4.2 ) ),
- ) );
+ return array( array( array(
+ '',
+ 'foo' => 'bar',
+ 'foo' => 'bar', 'baz' => 'BAH',
+ 'bar' => array( '9001' ),
+ '~[,,_,,]:3' => array( 9001, 4.2 ),
+ ) ) );
}
/**
@@ -125,17 +125,36 @@
}
/**
+ * Data provider that collects all individual smwg* settings
+ *
+ * @return array
+ */
+ public function dataGlobalsSettingsProvider() {
+ $settings = array_intersect_key( $GLOBALS,
+ array_flip( preg_grep('/^smwg/', array_keys( $GLOBALS )
) )
+ );
+
+ return array( array( $settings ) );
+ }
+
+ /**
* Test Settings::newFromGlobals
*
* @since 1.9
+ *
+ * @dataProvider dataGlobalsSettingsProvider
+ * @param array $settings
*/
- public function testNewFromGlobals() {
+ public function testNewFromGlobals( array $settings ) {
$instance = Settings::newFromGlobals();
$this->assertInstanceOf( $this->className, $instance );
- $this->assertEquals(
- $GLOBALS['smwgDefaultStore'],
- $instance->get( 'smwgDefaultStore' )
- );
+
+ foreach ( $settings as $key => $value ) {
+ $this->assertEquals(
+ $GLOBALS[$key],
+ $instance->get( $key )
+ );
+ }
}
/**
--
To view, visit https://gerrit.wikimedia.org/r/60365
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I54e6857c80f6f136ea1b84fd54709a972436c8ed
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/SemanticMediaWiki
Gerrit-Branch: master
Gerrit-Owner: Mwjames <[email protected]>
Gerrit-Reviewer: Mwjames <[email protected]>
Gerrit-Reviewer: jenkins-bot
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits