/** * This function checks for any new items in the config dist file */ function test_checkForConfigAdditions() { $oUpConfig = new OA_Upgrade_Config(); // First check that the working config file agrees with the dist config file $this->assertFalse($oUpConfig->checkForConfigAdditions($new), 'New config items have NOT been added to working test.conf.php'); // Assert no new items detected when $new === $old $new = $oUpConfig->aConfig; $this->assertFalse($oUpConfig->checkForConfigAdditions($new), 'New dist.conf.php items mistakenly detected'); // Add a new item to an existing sub-array $new = $oUpConfig->aConfig; $new['database']['key'] = 'value'; $this->assertTrue($oUpConfig->checkForConfigAdditions($new), 'New dist.conf.php items (added to existing section) not detected'); // Add a completely new empty sub-array $new = $oUpConfig->aConfig; $new['newSubArray'] = array(); $this->assertTrue($oUpConfig->checkForConfigAdditions($new), 'New dist.conf.php items (empty section) not detected'); // Add a new sub-array with a new item $new = $oUpConfig->aConfig; $new['newSubArray'] = array('key' => 'value'); $this->assertTrue($oUpConfig->checkForConfigAdditions($new), 'New dist.conf.php items (new section with value) not detected'); // Add a new item not in a sub-array (so top level) $new = $oUpConfig->aConfig; $new['key'] = 'value'; $this->assertTrue($oUpConfig->checkForConfigAdditions($new), 'New (top level) dist.conf.php items not detected'); }