Don't run tests on databases that don't exist
This commit is contained in:
parent
34bb867575
commit
25e278df64
@ -21,17 +21,21 @@ abstract class DBTest extends UnitTestCase {
|
|||||||
|
|
||||||
function tearDown()
|
function tearDown()
|
||||||
{
|
{
|
||||||
unset($this->db);
|
$this->db = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
function TestGetTables()
|
function TestGetTables()
|
||||||
{
|
{
|
||||||
|
if (empty($this->db)) return;
|
||||||
|
|
||||||
$tables = $this->db->get_tables();
|
$tables = $this->db->get_tables();
|
||||||
$this->assertTrue(is_array($tables));
|
$this->assertTrue(is_array($tables));
|
||||||
}
|
}
|
||||||
|
|
||||||
function TestGetSystemTables()
|
function TestGetSystemTables()
|
||||||
{
|
{
|
||||||
|
if (empty($this->db)) return;
|
||||||
|
|
||||||
$tables = $this->db->get_system_tables();
|
$tables = $this->db->get_system_tables();
|
||||||
|
|
||||||
$this->assertTrue(is_array($tables));
|
$this->assertTrue(is_array($tables));
|
||||||
@ -39,12 +43,16 @@ abstract class DBTest extends UnitTestCase {
|
|||||||
|
|
||||||
function TestCreateTransaction()
|
function TestCreateTransaction()
|
||||||
{
|
{
|
||||||
|
if (empty($this->db)) return;
|
||||||
|
|
||||||
$res = $this->db->beginTransaction();
|
$res = $this->db->beginTransaction();
|
||||||
$this->assertTrue($res);
|
$this->assertTrue($res);
|
||||||
}
|
}
|
||||||
|
|
||||||
function TestPreparedStatements()
|
function TestPreparedStatements()
|
||||||
{
|
{
|
||||||
|
if (empty($this->db)) return;
|
||||||
|
|
||||||
$sql = <<<SQL
|
$sql = <<<SQL
|
||||||
INSERT INTO "create_test" ("id", "key", "val")
|
INSERT INTO "create_test" ("id", "key", "val")
|
||||||
VALUES (?,?,?)
|
VALUES (?,?,?)
|
||||||
@ -57,6 +65,8 @@ SQL;
|
|||||||
|
|
||||||
function TestPrepareExecute()
|
function TestPrepareExecute()
|
||||||
{
|
{
|
||||||
|
if (empty($this->db)) return;
|
||||||
|
|
||||||
$sql = <<<SQL
|
$sql = <<<SQL
|
||||||
INSERT INTO "create_test" ("id", "key", "val")
|
INSERT INTO "create_test" ("id", "key", "val")
|
||||||
VALUES (?,?,?)
|
VALUES (?,?,?)
|
||||||
@ -69,6 +79,8 @@ SQL;
|
|||||||
|
|
||||||
function TestCommitTransaction()
|
function TestCommitTransaction()
|
||||||
{
|
{
|
||||||
|
if (empty($this->db)) return;
|
||||||
|
|
||||||
$res = $this->db->beginTransaction();
|
$res = $this->db->beginTransaction();
|
||||||
|
|
||||||
$sql = 'INSERT INTO "create_test" ("id", "key", "val") VALUES (10, 12, 14)';
|
$sql = 'INSERT INTO "create_test" ("id", "key", "val") VALUES (10, 12, 14)';
|
||||||
@ -80,6 +92,8 @@ SQL;
|
|||||||
|
|
||||||
function TestRollbackTransaction()
|
function TestRollbackTransaction()
|
||||||
{
|
{
|
||||||
|
if (empty($this->db)) return;
|
||||||
|
|
||||||
$res = $this->db->beginTransaction();
|
$res = $this->db->beginTransaction();
|
||||||
|
|
||||||
$sql = 'INSERT INTO "create_test" ("id", "key", "val") VALUES (182, 96, 43)';
|
$sql = 'INSERT INTO "create_test" ("id", "key", "val") VALUES (182, 96, 43)';
|
||||||
|
Loading…
Reference in New Issue
Block a user