From 13704b8f628af43c5bd1c404cb4eb2ef4d550401 Mon Sep 17 00:00:00 2001 From: Dries Buytaert Date: Mon, 1 Mar 2010 11:30:37 +0000 Subject: - Patch #722912 by andypost: db_index_exists() must conform schemaAPI indexExists(). --- modules/simpletest/tests/database_test.test | 20 ++++++++++++++------ modules/simpletest/tests/schema.test | 8 ++++---- 2 files changed, 18 insertions(+), 10 deletions(-) (limited to 'modules/simpletest/tests') 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 @@ -2390,20 +2390,28 @@ class DatabaseRegressionTestCase extends DatabaseTestCase { $this->assertIdentical($name, $from_database, t("The database handles UTF-8 characters cleanly.")); } + /** + * 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'); -- cgit v1.2.3