本文整理匯總了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);
}
}