Commit 738b58ec authored by Dries's avatar Dries

- Patch #310607 by mfb: added tests for db_column_exists() and db_table_exists(). Yay\!

parent 9c72e920
......@@ -1789,6 +1789,22 @@ class DatabaseRegressionTestCase extends DatabaseTestCase {
$from_database = db_query("SELECT name FROM {test} WHERE name = :name", array(':name' => $name))->fetchField();
$this->assertIdentical($name, $from_database, t("The database handles UTF-8 characters cleanly."));
}
/**
* Test the db_column_exists() function.
*/
function testDBColumnExists() {
$this->assertTrue(db_column_exists('node', 'nid'), t('Returns true for existent column.'));
$this->assertFalse(db_column_exists('node', 'nosuchcolumn'), t('Returns false for nonexistent column.'));
}
/**
* Test the db_table_exists() function.
*/
function testDBTableExists() {
$this->assertTrue(db_table_exists('node'), t('Returns true for existent table.'));
$this->assertFalse(db_table_exists('nosuchtable'), t('Returns false for nonexistent table.'));
}
}
/**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment