bug 2824: improving error messages from test suite errors
authorAndrew Moore <andrew.moore@liblime.com>
Wed, 17 Dec 2008 14:39:17 +0000 (08:39 -0600)
committerHenri-Damien LAURENT <henridamien@koha-fr.org>
Tue, 27 Jan 2009 11:19:41 +0000 (12:19 +0100)
This patch adds two warning messages to places in the test suite that
may fail. I don't think it changes any functionality, but it sure makes
it easier to figure out what has gone wrong.

Signed-off-by: Galen Charlton <galen.charlton@liblime.com>
t/lib/KohaTest.pm

index 544444a..887eea4 100644 (file)
@@ -698,7 +698,10 @@ sub drop_all_foreign_keys {
         if ($id) {
             # we have found 1 foreign, drop it
             $dbh->do("ALTER TABLE $table DROP FOREIGN KEY $id");
-            $id="";
+            if ( $dbh->err ) {
+                diag "unable to DROP FOREIGN KEY '$id' on TABLE '$table' due to: " . $dbh->errstr();
+            }
+            undef $id;
         }
     }
 }
@@ -706,6 +709,9 @@ sub drop_all_foreign_keys {
 sub drop_table {
     my ($dbh, $table) = @_;
     $dbh->do("DROP TABLE $table");
+    if ( $dbh->err ) {
+        diag "unable to drop table: '$table' due to: " . $dbh->errstr();
+    }
 }
 
 =head3 create_test_database