From 844e5573f0ce27f716f33a6e450a69a5d281a4d2 Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Wed, 3 Dec 2008 03:49:45 +0000 Subject: Make sure that the dev is not using the same db for tests as they are for production (this one's for you, valiant!) --- modules/gallery_unit_test/controllers/gallery_unit_test.php | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'modules/gallery_unit_test/controllers') diff --git a/modules/gallery_unit_test/controllers/gallery_unit_test.php b/modules/gallery_unit_test/controllers/gallery_unit_test.php index 1185fb95..2d70aad8 100644 --- a/modules/gallery_unit_test/controllers/gallery_unit_test.php +++ b/modules/gallery_unit_test/controllers/gallery_unit_test.php @@ -37,6 +37,13 @@ class Gallery_Unit_Test_Controller extends Controller { return; } + if ($db_config['default']['connection']['database'] == + $db_config['unit_test']['connection']['database']) { + print "Don't use the default database for your unit tests or you'll lose all your data.\n"; + print "Try using '{$db_config['default']['connection']['database']}_test' in $test_config\n"; + return; + } + try { $db = Database::instance('unit_test'); $db->connect(); -- cgit v1.2.3