本文整理汇总了PHP中Drupal\Core\Config\Config::setSettingsOverride方法的典型用法代码示例。如果您正苦于以下问题:PHP Config::setSettingsOverride方法的具体用法?PHP Config::setSettingsOverride怎么用?PHP Config::setSettingsOverride使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Drupal\Core\Config\Config
的用法示例。
在下文中一共展示了Config::setSettingsOverride方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testOverrideData
/**
* @covers ::setModuleOverride
* @covers ::setSettingsOverride
* @covers ::getOriginal
* @dataProvider overrideDataProvider
*/
public function testOverrideData($data, $module_data, $setting_data)
{
// Set initial data.
$this->config->setData($data);
// Check original data was set correctly.
$this->assertConfigDataEquals($data);
// Save so that the original data is stored.
$this->config->save();
// Set module override data and check value before and after save.
$this->config->setModuleOverride($module_data);
$this->assertConfigDataEquals($module_data);
$this->config->save();
$this->assertConfigDataEquals($module_data);
// Set setting override data and check value before and after save.
$this->config->setSettingsOverride($setting_data);
$this->assertConfigDataEquals($setting_data);
$this->config->save();
$this->assertConfigDataEquals($setting_data);
// Set module overrides again to ensure override order is correct.
$this->config->setModuleOverride($module_data);
// Setting data should be overriding module data.
$this->assertConfigDataEquals($setting_data);
$this->config->save();
$this->assertConfigDataEquals($setting_data);
// Check original data has not changed.
$this->assertOriginalConfigDataEquals($data, FALSE);
// Check setting overrides are returned with $apply_overrides = TRUE.
$this->assertOriginalConfigDataEquals($setting_data, TRUE);
// Check that $apply_overrides defaults to TRUE.
foreach ($setting_data as $key => $value) {
$config_value = $this->config->getOriginal($key);
$this->assertEquals($value, $config_value);
}
}