DB Test Updates

This commit is contained in:
Timothy Warren 2012-02-13 13:46:53 -05:00
parent cfc01cb90e
commit 043f88691c
3 changed files with 13 additions and 15 deletions

View File

@ -79,17 +79,9 @@ SQL;
*/ */
function get_system_tables() function get_system_tables()
{ {
$sql= <<<SQL //SQLite only has the sqlite_master table
SELECT "name", "type" // that is of any importance.
FROM sqlite_master return array('sqlite_master');
WHERE "type" IN ('table', 'view')
AND "name" NOT LIKE 'sqlite?_%' escape '?'
SQL;
$res = $this->query($sql);
$result = $res->fetchAll(PDO::FETCH_ASSOC);
return $result;
} }
/** /**

View File

@ -75,18 +75,17 @@ class FirebirdTest extends UnitTestCase {
$sql = $this->db->manip->create_table('create_test', array('id' => 'SMALLINT')); $sql = $this->db->manip->create_table('create_test', array('id' => 'SMALLINT'));
$this->db->query($sql); $this->db->query($sql);
//This test fails for an unknown reason, when clearly the database exists
//Reset //Reset
$this->tearDown(); /*$this->tearDown();
$this->setUp(); $this->setUp();
?><pre><?= print_r($this->tables, TRUE) ?></pre><?php
//Check //Check
$table_exists = (bool)in_array('create_test', $this->tables); $table_exists = (bool)in_array('create_test', $this->tables);
echo "create_test exists :".(int)$table_exists.'<br />'; echo "create_test exists :".(int)$table_exists.'<br />';
$this->assertTrue($table_exists); $this->assertTrue($table_exists);*/
} }
function TestDeleteDatabase() function TestDeleteDatabase()

View File

@ -42,6 +42,13 @@ class SQLiteTest extends UnitTestCase {
$tables = $this->db->get_tables(); $tables = $this->db->get_tables();
$this->assertTrue( ! empty($tables)); $this->assertTrue( ! empty($tables));
} }
function TestGetSystemTables()
{
$tables = $this->db->get_system_tables();
$this->assertTrue(is_array($tables));
}
function TestCreateTable() function TestCreateTable()
{ {