Don't run tests on databases that don't exist!

And remove query echoing
This commit is contained in:
Timothy Warren 2012-03-19 14:36:20 -04:00
parent bf98dc55d4
commit a59ab40061
2 changed files with 16 additions and 4 deletions

View File

@ -1063,7 +1063,7 @@ class Query_Builder {
break;
}
echo $sql.'<br />';
// echo $sql.'<br />';
return $sql;
}

View File

@ -12,8 +12,6 @@
// --------------------------------------------------------------------------
// --------------------------------------------------------------------------
/**
* Parent Database Test Class
*/
@ -23,17 +21,21 @@ abstract class DBTest extends UnitTestCase {
function tearDown()
{
unset($this->db);
$this->db = NULL;
}
function TestGetTables()
{
if (empty($this->db)) return;
$tables = $this->db->get_tables();
$this->assertTrue(is_array($tables));
}
function TestGetSystemTables()
{
if (empty($this->db)) return;
$tables = $this->db->get_system_tables();
$this->assertTrue(is_array($tables));
@ -41,12 +43,16 @@ abstract class DBTest extends UnitTestCase {
function TestCreateTransaction()
{
if (empty($this->db)) return;
$res = $this->db->beginTransaction();
$this->assertTrue($res);
}
function TestPreparedStatements()
{
if (empty($this->db)) return;
$sql = <<<SQL
INSERT INTO "create_test" ("id", "key", "val")
VALUES (?,?,?)
@ -59,6 +65,8 @@ SQL;
function TestPrepareExecute()
{
if (empty($this->db)) return;
$sql = <<<SQL
INSERT INTO "create_test" ("id", "key", "val")
VALUES (?,?,?)
@ -71,6 +79,8 @@ SQL;
function TestCommitTransaction()
{
if (empty($this->db)) return;
$res = $this->db->beginTransaction();
$sql = 'INSERT INTO "create_test" ("id", "key", "val") VALUES (10, 12, 14)';
@ -82,6 +92,8 @@ SQL;
function TestRollbackTransaction()
{
if (empty($this->db)) return;
$res = $this->db->beginTransaction();
$sql = 'INSERT INTO "create_test" ("id", "key", "val") VALUES (182, 96, 43)';