From: Florent Bruneau Date: Sat, 1 May 2010 13:37:49 +0000 (+0200) Subject: Non-fatal SQL errors when running unit tests. X-Git-Tag: core/1.1.0~23 X-Git-Url: http://git.polytechnique.org/?a=commitdiff_plain;h=737f1378c3bcebbbbf04fef0c0ffb9c99a1e4946;p=platal.git Non-fatal SQL errors when running unit tests. Signed-off-by: Florent Bruneau --- 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: ?>