12 $factory->register(
'unittest',
'GlobalVarConfig::newInstance' );
13 $this->
assertInstanceOf( GlobalVarConfig::class, $factory->makeConfig(
'unittest' ) );
22 $factory->register(
'invalid',
'Invalid callback' );
31 $factory->register(
'invalidInstance',
new stdClass );
38 $config = GlobalVarConfig::newInstance();
40 $factory->register(
'unittest', $config );
41 $this->
assertSame( $config, $factory->makeConfig(
'unittest' ) );
49 $factory->register(
'unittest',
'GlobalVarConfig::newInstance' );
50 $config1 = $factory->makeConfig(
'unittest' );
52 $factory->register(
'unittest',
'GlobalVarConfig::newInstance' );
53 $config2 = $factory->makeConfig(
'unittest' );
63 $oldFactory->register(
'foo',
'GlobalVarConfig::newInstance' );
64 $oldFactory->register(
'bar',
'GlobalVarConfig::newInstance' );
65 $oldFactory->register(
'quux',
'GlobalVarConfig::newInstance' );
68 $foo = $oldFactory->makeConfig(
'foo' );
69 $bar = $oldFactory->makeConfig(
'bar' );
70 $quux = $oldFactory->makeConfig(
'quux' );
74 $newFactory->register(
'foo',
'GlobalVarConfig::newInstance' );
75 $newFactory->register(
'bar',
function () {
81 $newFactory->salvage( $oldFactory );
83 $newFoo = $newFactory->makeConfig(
'foo' );
84 $this->
assertSame( $foo, $newFoo,
'existing instance should be salvaged' );
86 $newBar = $newFactory->makeConfig(
'bar' );
87 $this->
assertNotSame( $bar, $newBar,
'don\'t salvage if callbacks differ' );
91 $newFactory->makeConfig(
'quux' );
99 $factory->register(
'foo',
'GlobalVarConfig::newInstance' );
100 $factory->register(
'bar',
new HashConfig() );
102 $this->
assertEquals( [
'foo',
'bar' ], $factory->getConfigNames() );
110 $factory->register(
'unittest',
'GlobalVarConfig::newInstance' );
112 $conf = $factory->makeConfig(
'unittest' );
114 $this->
assertSame( $conf, $factory->makeConfig(
'unittest' ) );
123 $factory->register(
'test', $conf );
124 $this->
assertSame( $conf, $factory->makeConfig(
'test' ) );
132 $factory->register(
'*',
'GlobalVarConfig::newInstance' );
133 $conf = $factory->makeConfig(
'unittest' );
143 $factory->makeConfig(
'nobuilderregistered' );
151 $factory->register(
'unittest',
function () {
155 $factory->makeConfig(
'unittest' );
164 $factory = MediaWikiServices::getInstance()->getConfigFactory();
and that you know you can do these things To protect your we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights These restrictions translate to certain responsibilities for you if you distribute copies of the or if you modify it For if you distribute copies of such a whether gratis or for a you must give the recipients all the rights that you have You must make sure that receive or can get the source code And you must show them these terms so they know their rights We protect your rights with two and(2) offer you this license which gives you legal permission to copy
testRegister()
ConfigFactory::register.
testRegisterInvalid()
ConfigFactory::register.
testMakeConfigWithCallback()
ConfigFactory::makeConfig.
testMakeConfigWithInvalidCallback()
ConfigFactory::makeConfig.
testMakeConfigWithNoBuilders()
ConfigFactory::makeConfig.
testGetDefaultInstance()
ConfigFactory::getDefaultInstance.
testRegisterInvalidInstance()
ConfigFactory::register.
testRegisterInstance()
ConfigFactory::register.
testMakeConfigFallback()
ConfigFactory::makeConfig.
testGetConfigNames()
ConfigFactory::getConfigNames.
testRegisterAgain()
ConfigFactory::register.
testSalvage()
ConfigFactory::salvage.
testMakeConfigWithObject()
ConfigFactory::makeConfig.
Factory class to create Config objects.
A Config instance which stores all settings as a member variable.