/** * @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); } }