diff options
author | Angie Byron <webchick@24967.no-reply.drupal.org> | 2010-02-23 05:07:18 +0000 |
---|---|---|
committer | Angie Byron <webchick@24967.no-reply.drupal.org> | 2010-02-23 05:07:18 +0000 |
commit | 6192e19f60cd6e0a7f4c5841271ca9caf5eeafa4 (patch) | |
tree | 88f2bd86af7aafd6c36b869c7894f37ea1f4e314 /modules | |
parent | fa02c4f4e931ba3fda37835971a8a0fd6de0365c (diff) | |
download | brdo-6192e19f60cd6e0a7f4c5841271ca9caf5eeafa4.tar.gz brdo-6192e19f60cd6e0a7f4c5841271ca9caf5eeafa4.tar.bz2 |
#720620 by andypost: Fixed indexExists() for pgsql and sqlite does not prefix tablename.
Diffstat (limited to 'modules')
-rw-r--r-- | modules/simpletest/tests/schema.test | 25 |
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() { |