9 $config = GlobalVarConfig::newInstance();
10 $this->assertInstanceOf( GlobalVarConfig::class, $config );
14 $this->assertEquals(
'somevalue', $config->get(
'Baz' ) );
22 $var = $prefix .
'GlobalVarConfigTest';
27 $this->assertInstanceOf( GlobalVarConfig::class, $config );
28 $this->assertEquals( $rand, $config->get(
'GlobalVarConfigTest' ) );
36 [
'blahblahblahblah' ],
50 $this->assertTrue( $config->has(
'GlobalVarConfigTestHas' ) );
51 $this->assertFalse( $config->has(
'GlobalVarConfigTestNotHas' ) );
56 'wgSomething' =>
'default1',
57 'wgFoo' =>
'default2',
58 'efVariable' =>
'default3',
62 foreach ( $set as $var =>
$value ) {
67 [
'Something',
'wg',
'default1' ],
68 [
'Foo',
'wg',
'default2' ],
69 [
'Variable',
'ef',
'default3' ],
70 [
'BAR',
'',
'default4' ],
71 [
'ThisGlobalWasNotSetAbove',
'wg',
false ]
83 public function testGet( $name, $prefix, $expected ) {
85 if ( $expected ===
false ) {
86 $this->setExpectedException( ConfigException::class,
'GlobalVarConfig::get: undefined option:' );
88 $this->assertEquals( $config->get( $name ), $expected );
92 if ( array_key_exists( $var,
$GLOBALS ) ) {
wfRandomString( $length=32)
Get a random string containing a number of pseudo-random hex characters.
testHas()
GlobalVarConfig::has GlobalVarConfig::hasWithPrefix.
testConstructor( $prefix)
GlobalVarConfig::__construct provideConstructor.
static provideConstructor()
testNewInstance()
GlobalVarConfig::newInstance.
testGet( $name, $prefix, $expected)
provideGet GlobalVarConfig::get GlobalVarConfig::getWithPrefix
Accesses configuration settings from $GLOBALS.
processing should stop and the error should be shown to the user * false