本文整理汇总了PHP中ConfigFactory::makeConfig方法的典型用法代码示例。如果您正苦于以下问题:PHP ConfigFactory::makeConfig方法的具体用法?PHP ConfigFactory::makeConfig怎么用?PHP ConfigFactory::makeConfig使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ConfigFactory
的用法示例。
在下文中一共展示了ConfigFactory::makeConfig方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testMakeConfigWithInvalidCallback
/**
* @covers ConfigFactory::makeConfig
*/
public function testMakeConfigWithInvalidCallback()
{
$factory = new ConfigFactory();
$factory->register('unittest', function () {
return true;
// Not a Config object
});
$this->setExpectedException('UnexpectedValueException');
$factory->makeConfig('unittest');
}
示例2: makeTestConfigFactoryInstantiator
/**
* @param ConfigFactory $oldFactory
* @param Config[] $configurations
*
* @return Closure
*/
private static function makeTestConfigFactoryInstantiator(ConfigFactory $oldFactory, array $configurations)
{
return function (MediaWikiServices $services) use($oldFactory, $configurations) {
$factory = new ConfigFactory();
// clone configurations from $oldFactory that are not overwritten by $configurations
$namesToClone = array_diff($oldFactory->getConfigNames(), array_keys($configurations));
foreach ($namesToClone as $name) {
$factory->register($name, $oldFactory->makeConfig($name));
}
foreach ($configurations as $name => $config) {
$factory->register($name, $config);
}
return $factory;
};
}