Import DB and fixtures as a separate step

Usually triggered by manual test session environment runs
This commit is contained in:
Ingo Schommer 2014-03-19 08:42:23 +13:00
parent 7f4b5dd19b
commit 41cdc87eae

View File

@ -130,7 +130,25 @@ class SilverStripeContext extends MinkContext implements SilverStripeAwareContex
);
}
$this->testSessionEnvironment->startTestSession($this->getTestSessionState());
$state = $this->getTestSessionState();
$this->testSessionEnvironment->startTestSession($state);
// Optionally import database
if(!empty($state['importDatabasePath'])) {
$this->testSessionEnvironment->importDatabase(
$state['importDatabasePath'],
!empty($state['requireDefaultRecords']) ? $state['requireDefaultRecords'] : false
);
} else if(!empty($state['requireDefaultRecords']) && $state['requireDefaultRecords']) {
$this->testSessionEnvironment->requireDefaultRecords();
}
// Fixtures
$fixtureFile = (!empty($params['fixture'])) ? $params['fixture'] : null;
if($fixtureFile) {
$this->testSessionEnvironment->loadFixtureIntoDb($fixtureFile);
}
if($screenSize = getenv('BEHAT_SCREEN_SIZE')) {
list($screenWidth, $screenHeight) = explode('x', $screenSize);