function testMergeConfigChanges() { // Build a test dist.conf.php $oDistConf = new OA_Admin_Settings(true); $oDistConf->aConf['foo'] = array('one' => 'bar', 'two' => 'baz', 'new' => 'additional_value'); $oDistConf->aConf['webpath']['admin'] = 'disthost'; $oDistConf->aConf['webpath']['delivery'] = 'disthost'; $oDistConf->aConf['webpath']['deliverySSL'] = 'disthost'; $oDistConf->aConf['new'] = array('new_key' => 'new_value'); $distFilename = 'oa_test_dist' . rand(); $this->assertTrue($oDistConf->writeConfigChange($this->basePath, $distFilename, false), 'Error writing config file'); // Build a test user conf $oUserConf = new OA_Admin_Settings(true); $oUserConf->aConf['foo'] = array('one' => 'bar', 'two' => 'baz', 'old' => 'old_value'); $oUserConf->aConf['deprecated'] = array('old_key' => 'old_value'); $oUserConf->aConf['webpath']['admin'] = 'localhost'; $oUserConf->aConf['webpath']['delivery'] = 'localhost'; $oUserConf->aConf['webpath']['deliverySSL'] = 'localhost'; $userFilename = 'oa_test_user' . rand(); $this->assertTrue($oUserConf->writeConfigChange($this->basePath, $userFilename), 'Error writing config file'); $expected = array('foo' => array('one' => 'bar', 'two' => 'baz', 'new' => 'additional_value'), 'webpath' => array('admin' => 'localhost', 'delivery' => 'localhost', 'deliverySSL' => 'localhost'), 'new' => array('new_key' => 'new_value')); $this->assertEqual($expected, $oUserConf->mergeConfigChanges($this->basePath . '/disthost.' . $distFilename . '.conf.php'), 'Config files don\'t match'); // Clean up unlink($this->basePath . '/disthost.' . $distFilename . '.conf.php'); unlink($this->basePath . '/localhost.' . $userFilename . '.conf.php'); unlink($this->basePath . '/default.' . $distFilename . '.conf.php'); }