From 89191e702cad9dae78151addd19185695fb19d39 Mon Sep 17 00:00:00 2001 From: Florian Pritz Date: Sun, 8 Feb 2015 01:14:26 +0100 Subject: run-tests.sh: Clean up old database before running tests Signed-off-by: Florian Pritz --- application/controllers/tools.php | 4 ++++ run-tests.sh | 1 + 2 files changed, 5 insertions(+) diff --git a/application/controllers/tools.php b/application/controllers/tools.php index f04f86224..e36b09b79 100644 --- a/application/controllers/tools.php +++ b/application/controllers/tools.php @@ -55,6 +55,10 @@ class Tools extends MY_Controller { } } + if (empty($tables_to_drop)) { + return; + } + $this->db->query('SET FOREIGN_KEY_CHECKS = 0'); $this->db->query('DROP TABLE '.implode(", ", $tables_to_drop)); $this->db->query('SET FOREIGN_KEY_CHECKS = 1'); diff --git a/run-tests.sh b/run-tests.sh index 0b6cea761..6c4ed2701 100755 --- a/run-tests.sh +++ b/run-tests.sh @@ -48,6 +48,7 @@ tests=(${tests[@]#$testpath\/}) tests=(${tests[@]%.php}) # run tests +php index.php tools drop_all_tables_using_prefix php index.php tools update_database prove -ve "php index.php tools test $url" "${tests[@]}" php index.php tools drop_all_tables_using_prefix -- cgit v1.2.3-24-g4f1b