/** * @dataProvider getTestDataForDumpSortTest */ public function test_dumpChanges_CorrectlySortsSections_ByWhenTheyAppearInConfigFiles($defaultSettingsFiles, $userSettingsFile, $changesToApply, $header, $expectedDumpChanges) { $fileChain = new IniFileChain($defaultSettingsFiles, $userSettingsFile); foreach ($changesToApply as $sectionName => $section) { $fileChain->set($sectionName, $section); } $actualOutput = $fileChain->dumpChanges($header); $this->assertEquals($expectedDumpChanges, $actualOutput); }
public function __construct($settingsChain, $mergedSettings) { parent::__construct(); $this->settingsChain = $settingsChain; $this->mergedSettings = $mergedSettings; }
/** * Dump config * * @return string|null * @throws \Exception */ public function dumpConfig() { $header = "; <?php exit; ?> DO NOT REMOVE THIS LINE\n"; $header .= "; file automatically generated or modified by Piwik; you can manually override the default values in global.ini.php by redefining them in this file.\n"; return $this->settings->dumpChanges($header); }