mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
Added dev/tests/emptydb to clear out test session databases.
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/branches/2.4@109099 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
6d5f83ad59
commit
22d9c1fb4e
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user