Added dev/tests/emptydb to clear out test session databases. (from r109099)

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@112777 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Sam Minnee 2010-10-19 00:54:31 +00:00
parent 829d532b6a
commit 0d6cb295c4

View File

@ -46,6 +46,7 @@ class TestRunner extends Controller {
'startsession' => 'startsession',
'endsession' => 'endsession',
'cleanupdb' => 'cleanupdb',
'emptydb' => 'emptydb',
'module/$ModuleName' => 'module',
'all' => 'all',
'build' => 'build',
@ -387,6 +388,24 @@ HTML;
}
}
function emptydb() {
if(SapphireTest::using_temp_db()) {
SapphireTest::empty_temp_db();
if(isset($_GET['fixture']) && ($fixtureFile = $_GET['fixture'])) {
$fixture = new YamlFixture($fixtureFile);
$fixture->saveIntoDatabase();
return "<p>Re-test the test database with fixture '$fixtureFile'. Time to start testing; where would you like to start?</p>";
} else {
return "<p>Re-test the test database. Time to start testing; where would you like to start?</p>";
}
} else {
return "<p>dev/tests/emptydb can only be used with a temporary database. Perhaps you should use dev/tests/startsession first?</p>";
}
}
function endsession() {
SapphireTest::kill_temp_db();
DB::set_alternative_database_name(null);