diff --git a/dev/TestRunner.php b/dev/TestRunner.php index 645a7fed5..8ccd88e0f 100644 --- a/dev/TestRunner.php +++ b/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 @@ 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 "
Re-test the test database with fixture '$fixtureFile'. Time to start testing; where would you like to start?
"; + + } else { + return "Re-test the test database. Time to start testing; where would you like to start?
"; + } + + } else { + return "dev/tests/emptydb can only be used with a temporary database. Perhaps you should use dev/tests/startsession first?
"; + } + } + function endsession() { SapphireTest::kill_temp_db(); DB::set_alternative_database_name(null);