From 737f1378c3bcebbbbf04fef0c0ffb9c99a1e4946 Mon Sep 17 00:00:00 2001 From: Florent Bruneau Date: Sat, 1 May 2010 15:37:49 +0200 Subject: [PATCH] Non-fatal SQL errors when running unit tests. Signed-off-by: Florent Bruneau --- classes/xdb.php | 14 ++++++++++++-- include/test.inc.php | 1 + 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/classes/xdb.php b/classes/xdb.php index d9bde66..e715eef 100644 --- a/classes/xdb.php +++ b/classes/xdb.php @@ -22,6 +22,7 @@ class XDB { private static $mysqli = null; + private static $fatalErrors = true; public static function connect() { @@ -39,6 +40,11 @@ class XDB return true; } + public static function setNonFatalError() + { + self::$fatalErrors = false; + } + public static function _prepare($args) { global $globals; @@ -127,8 +133,12 @@ class XDB . "--------------------------------------------------------------------------------\n"); fclose($file); } - Platal::page()->kill($text); - exit; + if (self::$fatalErrors) { + Platal::page()->kill($text); + exit; + } else { + throw new Exception($text . " :\n" . $query); + } } return $res; } diff --git a/include/test.inc.php b/include/test.inc.php index 2a7048e..c5dc418 100644 --- a/include/test.inc.php +++ b/include/test.inc.php @@ -31,6 +31,7 @@ if (file_exists($testinclude)) { pl_autoload($class); } } +XDB::setNonFatalError(); // vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8: ?> -- 2.1.4