Skip to content
Browse files

Added dev/tests/emptydb to clear out test session databases. (from r1…

…09099)

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@112777 467b73ca-7a2a-4603-9d3b-597d59a354a9
  • Loading branch information...
1 parent 829d532 commit 0d6cb295c468bc12f76104ee08b33afdfc5d4605 @sminnee sminnee committed
Showing with 19 additions and 0 deletions.
  1. +19 −0 dev/TestRunner.php
View
19 dev/TestRunner.php
@@ -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 @@ function startsession() {
}
}
+ 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);

0 comments on commit 0d6cb29

Please sign in to comment.
Something went wrong with that request. Please try again.