Author: Mike Lively (m@digitalsandwich.com)
Inheritance: extends PHPUnit_Extensions_Database_DataSet_AbstractXmlDataSet
コード例 #1
0
ファイル: ModelTestCase.php プロジェクト: ekowabaka/cfx
 private function runTableTests($expectedDataset, $tables, $filters)
 {
     $expectedDataset = new PHPUnit_Extensions_Database_DataSet_XmlDataSet($expectedDataset);
     $actualDataset = new PHPUnit_Extensions_Database_DataSet_DataSetFilter($this->getConnection()->createDataSet($tables), $filters);
     foreach ($tables as $table) {
         $this->assertTablesEqual($expectedDataset->getTable($table), $actualDataset->getTable($table));
     }
 }
コード例 #2
0
ファイル: PersistorTest.php プロジェクト: xiplias/pails
 public function testXml()
 {
     $dataSetFile = dirname(__FILE__) . '/../_files/XmlDataSets/XmlWriter.xml';
     $filename = dirname(__FILE__) . '/' . uniqid() . '.xml';
     $dataSet = new PHPUnit_Extensions_Database_DataSet_XmlDataSet($dataSetFile);
     PHPUnit_Extensions_Database_DataSet_XmlDataSet::write($dataSet, $filename);
     $this->assertXmlFileEqualsXmlFile($dataSetFile, $filename);
     unlink($filename);
 }
コード例 #3
0
 public function testEntitiesXml()
 {
     $metaData = new PHPUnit_Extensions_Database_DataSet_DefaultTableMetaData('table1', array('col1', 'col2'), array('col1'));
     $table = new PHPUnit_Extensions_Database_DataSet_DefaultTable($metaData);
     $table->addRow(array('col1' => 1, 'col2' => '<?xml version="1.0"?><myxml>test</myxml>'));
     $dataSet = new PHPUnit_Extensions_Database_DataSet_DefaultDataSet(array($table));
     $expectedFile = dirname(__FILE__) . '/../_files/XmlDataSets/XmlWriterEntities.xml';
     $filename = dirname(__FILE__) . '/' . uniqid() . '.xml';
     PHPUnit_Extensions_Database_DataSet_XmlDataSet::write($dataSet, $filename);
     $this->assertXmlFileEqualsXmlFile($expectedFile, $filename);
     unlink($filename);
 }
コード例 #4
0
 /**
  * Performs synchronisations on the database after a fixture has been loaded
  *
  * @param	PHPUnit_Extensions_Database_DataSet_XmlDataSet	$xml_data_set		Information about the tables contained within the loaded fixture
  *
  * @return null
  */
 public function post_setup_synchronisation($xml_data_set)
 {
     $table_names = $xml_data_set->getTableNames();
     $tables = array();
     foreach ($table_names as $table) {
         $tables[$table] = $xml_data_set->getTableMetaData($table)->getColumns();
     }
     $this->database_synchronisation($tables);
 }