[Koha-patches] [PATCH] bug 2824: improving error messages from test suite errors

Andrew Moore andrew.moore at liblime.com
Wed Dec 17 15:39:17 CET 2008


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.
---
 t/lib/KohaTest.pm |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/t/lib/KohaTest.pm b/t/lib/KohaTest.pm
index 544444a..887eea4 100644
--- a/t/lib/KohaTest.pm
+++ b/t/lib/KohaTest.pm
@@ -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
-- 
1.5.6




More information about the Koha-patches mailing list