/**
  * Stores (serializes) the config instance to an XML file
  * @param string xml config file name 
  * @return bool true if successful; false otherwise
  * @throws epExceptionConfig
  * @access public
  */
 public function store($cfg_file = DEF_CONFIG_FILE)
 {
     if (!($data = epValue2Xml($this->options()))) {
         throw new epExceptionConfig("Cannot unserialize options into XML");
         return false;
     }
     $fp = fopen($cfg_file, 'wb');
     if (!$fp) {
         throw new epExceptionConfig('Cannot open ' . $cfg_file);
         return false;
     }
     if (!fwrite($fp, $data, strlen($data))) {
         throw new epExceptionConfig('Cannot write to ' . $cfg_file);
         fclose($fp);
         return false;
     }
     fclose($fp);
     return true;
 }
 /**
  * Test function epFilesInDir() in epUtils.php
  */
 function test_epXml2Array_epValue2Xml()
 {
     // make sure methods exist
     $this->assertTrue(function_exists('epValue2Xml'));
     $this->assertTrue(function_exists('epXml2Array'));
     // an associated array to be tested
     $array0 = array('a' => array('b' => array('c' => 'x')));
     $array = $array0;
     $array['b'] = $array0;
     $array['c'] = $array0;
     $array['d'] = $array0;
     // unserialize array into xml
     $this->assertTrue($xml = epValue2Xml($array));
     // serialize xml into array
     $this->assertTrue($array_2 = epXml2Array($xml));
     // unserialize the new array into xml
     $this->assertTrue($xml_2 = epValue2Xml($array_2));
     // make sure the two xml strings are the same
     $this->assertTrue($xml == $xml_2);
 }