From 0e92ecea0c1dc57ccde5b1b152934a880960375a Mon Sep 17 00:00:00 2001 From: Damian Mooyman Date: Wed, 30 Nov 2016 10:59:37 +1300 Subject: [PATCH] ENHANCEMENT Prevent test DBs persisting after testing --- src/Dev/SapphireTest.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/Dev/SapphireTest.php b/src/Dev/SapphireTest.php index dc8bafd47..330856738 100644 --- a/src/Dev/SapphireTest.php +++ b/src/Dev/SapphireTest.php @@ -1082,6 +1082,11 @@ class SapphireTest extends PHPUnit_Framework_TestCase // Reinstate PHPUnit error handling set_error_handler(array('PHPUnit_Util_ErrorHandler', 'handleError')); + // Ensure test db is killed on exit + register_shutdown_function(function () { + static::kill_temp_db(); + }); + return $dbname; }