From a59ab40061b2afbdca8ad82dc9bdd934c7badb5b Mon Sep 17 00:00:00 2001 From: Timothy Warren Date: Mon, 19 Mar 2012 14:36:20 -0400 Subject: [PATCH] Don't run tests on databases that don't exist! And remove query echoing --- sys/db/query_builder.php | 2 +- tests/parent.php | 18 +++++++++++++++--- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/sys/db/query_builder.php b/sys/db/query_builder.php index 9eaaa31..5d82a16 100644 --- a/sys/db/query_builder.php +++ b/sys/db/query_builder.php @@ -1063,7 +1063,7 @@ class Query_Builder { break; } - echo $sql.'
'; + // echo $sql.'
'; return $sql; } diff --git a/tests/parent.php b/tests/parent.php index 792d129..9d1bf5c 100644 --- a/tests/parent.php +++ b/tests/parent.php @@ -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 = <<db)) return; + $sql = <<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)';