diff --git a/core/modules/forum/forum.test b/core/modules/forum/forum.test index 135f551..dbdadc3 100644 --- a/core/modules/forum/forum.test +++ b/core/modules/forum/forum.test @@ -590,3 +590,45 @@ class ForumTestCase extends DrupalWebTestCase { } } } + +/** + * Upgrade test for the forum module upgrade path. + */ +class ForumUpgradePathTestCase extends UpgradePathTestCase { + + public static function getInfo() { + return array( + 'name' => 'Forum upgrade test', + 'description' => 'Forum upgrade test.', + 'group' => 'Upgrade path', + ); + } + + public function setUp() { + $this->databaseDumpFiles = array( + drupal_get_path('module', 'system') . '/tests/upgrade/drupal-7.filled.database.php.gz', + ); + + $modules = array('taxonomy', 'comment', 'forum', 'node'); + parent::setUp(); + } + + /** + * Test a successful forum upgrade. + */ + public function testForumUpgrade() { + $this->assertTrue($this->performUpgrade(), 'The upgrade was completed successfully.'); + + // Ensure that the forum module is enabled after upgrade. + $this->assertTrue(module_exists('forum'), 'Forum module enabled after upgrade.'); + + // Get schema info for forum_index table. + $schema = drupal_get_schema('forum_index'); + + $indexes = array('forum_topics', 'create', 'last_comment'); + // Check all indexes exist in schema info. + foreach ($indexes as $index) { + $this->assertTrue(array_key_exists($index, $schema['indexes']), 'Index found in schema info'); + } + } +}