Is it possible to load multiple flat xml datasets on PHPUnit to load lots of fixtures?
We are writing a rather complex application and the xml dataset is getting pretty big, so I would like to slip it into 2-3 xml.
Here is the current code for a test case:
<?php
class My_TestBase extends Zend_Test_PHPUnit_DatabaseTestCase{
/**
* Zend_Application
* @var Zend_Application
*/
protected $_application;
/**
* Connection
*
* @var Zend_Test_PHPUnit_Db_Connection
*/
private $_connection;
/**
* Returns the test database connection.
*
* @link http://framework.zend.com/wiki/display/ZFPROP/Zend_Test_PHPUnit_Database+-+Benjamin+Eberlei
* @return PHPUnit_Extensions_Database_DB_IDatabaseConnection
*/
protected function getConnection(){
if($this->_connection === null){
$Resources = $this->_application->getOption("resources");
$conn = Zend_Db::factory($Resources["db"]["adapter"], $Resources["db"]["params"]);
$this->_connection = $this->createZendDbConnection($conn, $Resources["db"]["params"]["dbname"]);
}
return $this->_connection;
}
/**
* Returns the test dataset.
*
* @link http://framework.zend.com/wiki/display/ZFPROP/Zend_Test_PHPUnit_Database+-+Benjamin+Eberlei
* @return PHPUnit_Extensions_Database_DataSet_IDataSet
*/
protected function getDataSet(){
return $this->createFlatXMLDataSet(__DIR__."/seed_data.xml");
}
/**
* Setup
*/
protected function setUp(){
$this->_application = new Zend_Application(
APPLICATION_ENV,
APPLICATION_PATH . '/configs/application.ini'
);
}
}