summaryrefslogtreecommitdiff
path: root/modules/simpletest/tests/schema.test
diff options
context:
space:
mode:
Diffstat (limited to 'modules/simpletest/tests/schema.test')
-rw-r--r--modules/simpletest/tests/schema.test25
1 files changed, 14 insertions, 11 deletions
diff --git a/modules/simpletest/tests/schema.test b/modules/simpletest/tests/schema.test
index 1cf48e933..7f7571ef9 100644
--- a/modules/simpletest/tests/schema.test
+++ b/modules/simpletest/tests/schema.test
@@ -61,8 +61,22 @@ class SchemaTestCase extends DrupalWebTestCase {
// The insert should fail again.
$this->assertFalse($this->tryInsert(), t('Insert without a default failed.'));
+ // Test for fake index.
+ $index_exists = Database::getConnection()->schema()->indexExists('test_table', 'test_field');
+ $this->assertFalse($index_exists, t('Fake index does not exists'));
+ // Add index.
+ db_add_index('test_table', 'test_field', array('test_field'));
+ // Test for created index.
+ $index_exists = Database::getConnection()->schema()->indexExists('test_table', 'test_field');
+ $this->assertTrue($index_exists, t('Index created.'));
+
// Rename the table.
db_rename_table('test_table', 'test_table2');
+
+ // Index should be renamed.
+ $index_exists = Database::getConnection()->schema()->indexExists('test_table2', 'test_field');
+ $this->assertTrue($index_exists, t('Index was renamed.'));
+
// We need the default so that we can insert after the rename.
db_field_set_default('test_table2', 'test_field', 0);
$this->assertFalse($this->tryInsert(), t('Insert into the old table failed.'));
@@ -130,17 +144,6 @@ class SchemaTestCase extends DrupalWebTestCase {
}
/**
- * Test index status.
- */
- function testCheckIndex() {
- $node_changed_index = Database::getConnection()->schema()->indexExists('node', 'node_changed');
- $this->assertTrue($node_changed_index, t('Node index exists'));
-
- $node_fake_index = Database::getConnection()->schema()->indexExists('node', 'node_not_exists');
- $this->assertFalse($node_fake_index, t('Fake index does not exists'));
- }
-
- /**
* Tests creating unsigned columns and data integrity thereof.
*/
function testUnsignedColumns() {