From 25e278df64af098578bcfdd106c76dc5a765460c Mon Sep 17 00:00:00 2001 From: Timothy Warren Date: Mon, 19 Mar 2012 14:36:57 -0400 Subject: [PATCH] Don't run tests on databases that don't exist --- tests/parent.php | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/tests/parent.php b/tests/parent.php index bdbbf75..9daec28 100644 --- a/tests/parent.php +++ b/tests/parent.php @@ -21,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)); @@ -39,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)'; @@ -80,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)';