now you can use DB::$success_handler to replace the "debug mode" handler in the same way that you can

replace the error handler
This commit is contained in:
Sergey Tsalkov
2011-03-15 16:03:56 -04:00
parent c14c69ffa7
commit 74feeb6513
2 changed files with 35 additions and 13 deletions

View File

@@ -5,6 +5,11 @@ function new_error_callback($params) {
if (substr_count($params['error'], 'You have an error in your SQL syntax')) $error_callback_worked = 1;
}
function my_debug_handler($params) {
global $debug_callback_worked;
if (substr_count($params['query'], 'SELECT')) $debug_callback_worked = 1;
}
class BasicTest extends SimpleTest {
function __construct() {
@@ -136,8 +141,17 @@ class BasicTest extends SimpleTest {
$exception_was_caught = 2;
}
$this->assert($exception_was_caught === 2);
}
function test_7_debugmode_handler() {
global $debug_callback_worked;
DB::debugMode('my_debug_handler');
DB::query("SELECT * FROM accounts WHERE username!=%s", "Charlie's Friend");
$this->assert($debug_callback_worked === 1);
DB::debugMode(false);
}
}