Merge pull request #24 from IgorNadj/patch-1

ENH: allow specify database by filename
This commit is contained in:
Ingo Schommer 2015-10-18 14:09:59 +13:00
commit c5e9f33531

View File

@ -94,9 +94,24 @@ class TestSessionController extends Controller {
$this->environment->startTestSession($params, $id); $this->environment->startTestSession($params, $id);
// Optionally import database // Optionally import database
if(!empty($params['importDatabasePath']) || !empty($params['importDatabaseFilename'])) {
$absPath = '';
// by path
if(!empty($params['importDatabasePath'])) { if(!empty($params['importDatabasePath'])) {
$absPath = $params['importDatabasePath'];
// by filename
}else if(!empty($params['importDatabaseFilename'])) {
foreach($this->getDatabaseTemplates() as $tAbsPath => $tFilename){
if($tFilename === $params['importDatabaseFilename']){
$absPath = $tAbsPath;
break;
}
}
}
$this->environment->importDatabase( $this->environment->importDatabase(
$params['importDatabasePath'], $absPath,
!empty($params['requireDefaultRecords']) ? $params['requireDefaultRecords'] : false !empty($params['requireDefaultRecords']) ? $params['requireDefaultRecords'] : false
); );
} else if(!empty($params['requireDefaultRecords']) && $params['requireDefaultRecords']) { } else if(!empty($params['requireDefaultRecords']) && $params['requireDefaultRecords']) {