From 738b58ec5ea85881f702ee4bfa6d0d959c0f1604 Mon Sep 17 00:00:00 2001 From: Dries Buytaert Date: Fri, 21 Nov 2008 15:04:21 +0000 Subject: - Patch #310607 by mfb: added tests for db_column_exists() and db_table_exists(). Yay\! --- modules/simpletest/tests/database_test.test | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'modules/simpletest/tests') diff --git a/modules/simpletest/tests/database_test.test b/modules/simpletest/tests/database_test.test index 3325b189e..80b7dc26b 100644 --- a/modules/simpletest/tests/database_test.test +++ b/modules/simpletest/tests/database_test.test @@ -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.')); + } } /** -- cgit v1.2.3