Author: Mike Lively (m@digitalsandwich.com)
Inheritance: extends PHPUnit_Extensions_Database_DataSet_Persistors_Abstract
Example #1
0
 public static function write(PHPUnit_Extensions_Database_DataSet_IDataSet $dataset, $filename)
 {
     $pers = new PHPUnit_Extensions_Database_DataSet_Persistors_FlatXml();
     $pers->setFileName($filename);
     try {
         $pers->write($dataset);
     } catch (RuntimeException $e) {
         throw new PHPUnit_Framework_Exception(__METHOD__ . ' called with an unwritable file.');
     }
 }
Example #2
0
 /**
  * Returns the persistor.
  *
  * @param string $type
  * @param string $spec
  * @return PHPUnit_Extensions_Database_DataSet_IPersistable
  */
 public function getPersistorBySpec($type, $spec)
 {
     switch (strtolower($type)) {
         case 'xml':
             $xmlPersistor = new PHPUnit_Extensions_Database_DataSet_Persistors_Xml();
             $xmlPersistor->setFileName($spec);
             return $xmlPersistor;
         case 'flatxml':
             $flatXmlPersistor = new PHPUnit_Extensions_Database_DataSet_Persistors_FlatXml();
             $flatXmlPersistor->setFileName($spec);
             return $flatXmlPersistor;
         case 'yaml':
             $yamlPersistor = new PHPUnit_Extensions_Database_DataSet_Persistors_Yaml();
             $yamlPersistor->setFileName($spec);
             return $yamlPersistor;
         default:
             throw new PHPUnit_Extensions_Database_Exception("I don't know what you want from me. PERSISTOR");
     }
 }