}
public static function provideConstructor() {
- return array(
- array( 'wg' ),
- array( 'ef' ),
- array( 'smw' ),
- array( 'blahblahblahblah' ),
- array( '' ),
- );
+ return [
+ [ 'wg' ],
+ [ 'ef' ],
+ [ 'smw' ],
+ [ 'blahblahblahblah' ],
+ [ '' ],
+ ];
}
/**
}
public static function provideGet() {
- $set = array(
+ $set = [
'wgSomething' => 'default1',
'wgFoo' => 'default2',
'efVariable' => 'default3',
'BAR' => 'default4',
- );
+ ];
foreach ( $set as $var => $value ) {
$GLOBALS[$var] = $value;
}
- return array(
- array( 'Something', 'wg', 'default1' ),
- array( 'Foo', 'wg', 'default2' ),
- array( 'Variable', 'ef', 'default3' ),
- array( 'BAR', '', 'default4' ),
- array( 'ThisGlobalWasNotSetAbove', 'wg', false )
- );
+ return [
+ [ 'Something', 'wg', 'default1' ],
+ [ 'Foo', 'wg', 'default2' ],
+ [ 'Variable', 'ef', 'default3' ],
+ [ 'BAR', '', 'default4' ],
+ [ 'ThisGlobalWasNotSetAbove', 'wg', false ]
+ ];
}
/**
$this->assertEquals( $config->get( $name ), $expected );
}
- public static function provideSet() {
- return array(
- array( 'Foo', 'wg', 'wgFoo' ),
- array( 'SomethingRandom', 'wg', 'wgSomethingRandom' ),
- array( 'FromAnExtension', 'eg', 'egFromAnExtension' ),
- array( 'NoPrefixHere', '', 'NoPrefixHere' ),
- );
- }
-
private function maybeStashGlobal( $var ) {
if ( array_key_exists( $var, $GLOBALS ) ) {
// Will be reset after this test is over
$this->stashMwGlobals( $var );
}
}
-
- /**
- * @dataProvider provideSet
- * @covers GlobalVarConfig::set
- * @covers GlobalVarConfig::setWithPrefix
- */
- public function testSet( $name, $prefix, $var ) {
- $this->hideDeprecated( 'GlobalVarConfig::set' );
- $this->maybeStashGlobal( $var );
- $config = new GlobalVarConfig( $prefix );
- $random = wfRandomString();
- $config->set( $name, $random );
- $this->assertArrayHasKey( $var, $GLOBALS );
- $this->assertEquals( $random, $GLOBALS[$var] );
- }
}