Minor tweaks to exceptions

This commit is contained in:
Timothy Warren 2012-07-27 16:05:29 +00:00
parent d9a4b5fbe5
commit 9d8d07958f
3 changed files with 20 additions and 2 deletions

View File

@ -254,7 +254,7 @@ class Query_Builder {
} }
catch(Exception $e) catch(Exception $e)
{ {
throw new BadConnectionException('Connection failed, invalid arguments'); throw new BadConnectionException('Connection failed, invalid arguments', 2, $e);
} }
// Set the connection name property, if applicable // Set the connection name property, if applicable

View File

@ -426,7 +426,7 @@ abstract class QBTest extends UnitTestCase {
} }
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
// ! Other Tests // ! Error Tests
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
/** /**
@ -448,6 +448,24 @@ abstract class QBTest extends UnitTestCase {
$this->db = new Query_Builder($params); $this->db = new Query_Builder($params);
} }
// --------------------------------------------------------------------------
public function TestBadConnection()
{
$params = array(
'host' => '127.0.0.1',
'port' => '3306',
'database' => 'test',
'user' => NULL,
'pass' => NULL,
'type' => 'mysql'
);
$this->expectException('BadConnectionException');
$this->db = new Query_Builder($params);
}
} }
// End of db_qb_test.php // End of db_qb_test.php

Binary file not shown.