summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2010-03-01 11:30:37 +0000
committerDries Buytaert <dries@buytaert.net>2010-03-01 11:30:37 +0000
commit13704b8f628af43c5bd1c404cb4eb2ef4d550401 (patch)
tree0108353e4b66e5791fcd9c5c874a4da5a916209a /modules
parent74e94b7e019d29bb58928df0b5b5de8ec3651359 (diff)
downloadbrdo-13704b8f628af43c5bd1c404cb4eb2ef4d550401.tar.gz
brdo-13704b8f628af43c5bd1c404cb4eb2ef4d550401.tar.bz2
- Patch #722912 by andypost: db_index_exists() must conform schemaAPI indexExists().
Diffstat (limited to 'modules')
-rw-r--r--modules/simpletest/tests/database_test.test20
-rw-r--r--modules/simpletest/tests/schema.test8
2 files changed, 18 insertions, 10 deletions
diff --git a/modules/simpletest/tests/database_test.test b/modules/simpletest/tests/database_test.test
index cf569f7cc..3f3f80008 100644
--- a/modules/simpletest/tests/database_test.test
+++ b/modules/simpletest/tests/database_test.test
@@ -2391,19 +2391,27 @@ class DatabaseRegressionTestCase extends DatabaseTestCase {
}
/**
+ * Test the db_table_exists() function.
+ */
+ function testDBTableExists() {
+ $this->assertIdentical(TRUE, db_table_exists('node'), t('Returns true for existent table.'));
+ $this->assertIdentical(FALSE, db_table_exists('nosuchtable'), t('Returns false for nonexistent table.'));
+ }
+
+ /**
* 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.'));
+ $this->assertIdentical(TRUE, db_column_exists('node', 'nid'), t('Returns true for existent column.'));
+ $this->assertIdentical(FALSE, db_column_exists('node', 'nosuchcolumn'), t('Returns false for nonexistent column.'));
}
/**
- * Test the db_table_exists() function.
+ * Test the db_index_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.'));
+ function testDBIndexExists() {
+ $this->assertIdentical(TRUE, db_index_exists('node', 'node_created'), t('Returns true for existent index.'));
+ $this->assertIdentical(FALSE, db_index_exists('node', 'nosuchindex'), t('Returns false for nonexistent index.'));
}
}
diff --git a/modules/simpletest/tests/schema.test b/modules/simpletest/tests/schema.test
index 7f7571ef9..0ddead4dc 100644
--- a/modules/simpletest/tests/schema.test
+++ b/modules/simpletest/tests/schema.test
@@ -61,14 +61,14 @@ class SchemaTestCase extends DrupalWebTestCase {
// The insert should fail again.
$this->assertFalse($this->tryInsert(), t('Insert without a default failed.'));
- // Test for fake index.
+ // Test for fake index and test for the boolean result of indexExists().
$index_exists = Database::getConnection()->schema()->indexExists('test_table', 'test_field');
- $this->assertFalse($index_exists, t('Fake index does not exists'));
+ $this->assertIdentical($index_exists, FALSE, t('Fake index does not exists'));
// Add index.
db_add_index('test_table', 'test_field', array('test_field'));
- // Test for created index.
+ // Test for created index and test for the boolean result of indexExists().
$index_exists = Database::getConnection()->schema()->indexExists('test_table', 'test_field');
- $this->assertTrue($index_exists, t('Index created.'));
+ $this->assertIdentical($index_exists, TRUE, t('Index created.'));
// Rename the table.
db_rename_table('test_table', 'test_table2');