diff options
author | Dries Buytaert <dries@buytaert.net> | 2008-06-24 21:51:03 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2008-06-24 21:51:03 +0000 |
commit | 9b82787b223185ca835aba9f34f300837fcebb85 (patch) | |
tree | 154437e664fc945ff5e74c7cdc74778ea8f40b7b /modules/simpletest/simpletest.install | |
parent | 22c0a0a4b0d9be19ee1444f86135998145a8d682 (diff) | |
download | brdo-9b82787b223185ca835aba9f34f300837fcebb85.tar.gz brdo-9b82787b223185ca835aba9f34f300837fcebb85.tar.bz2 |
- Patch #243773 by chx, catch, boombatower, yched, dmitrig01, et al: use the batch API for running the tests instead of an all-in-one approach. Great work.
Diffstat (limited to 'modules/simpletest/simpletest.install')
-rw-r--r-- | modules/simpletest/simpletest.install | 124 |
1 files changed, 124 insertions, 0 deletions
diff --git a/modules/simpletest/simpletest.install b/modules/simpletest/simpletest.install index 074d250a6..6ede82d79 100644 --- a/modules/simpletest/simpletest.install +++ b/modules/simpletest/simpletest.install @@ -5,6 +5,7 @@ * Implementation of hook_install(). */ function simpletest_install() { + drupal_install_schema('simpletest'); // Check for files directory. $path = file_directory_path() . '/simpletest'; if (file_check_directory($path, FILE_CREATE_DIRECTORY)) { @@ -95,6 +96,7 @@ function simpletest_uninstall() { variable_del('simpletest_httpauth_username'); variable_del('simpletest_httpauth_pass'); variable_del('simpletest_devel'); + drupal_uninstall_schema('simpletest'); } /** @@ -133,3 +135,125 @@ function simpletest_requirements($phase) { return $requirements; } + +function simpletest_schema() { + $schema['simpletest'] = array( + 'description' => t('Stores simpletest messages'), + 'fields' => array( + 'message_id' => array( + 'type' => 'serial', + 'not null' => TRUE, + 'description' => t('Primary Key: Unique simpletest message ID.'), + ), + 'test_id' => array( + 'type' => 'int', + 'not null' => TRUE, + 'default' => 0, + 'description' => t('Test id, messages belonging to the same id are reported together'), + ), + 'test_class' => array( + 'type' => 'varchar', + 'length' => 255, + 'not null' => TRUE, + 'default' => '', + 'description' => t('The name of the class that created this message.'), + ), + 'status' => array( + 'type' => 'varchar', + 'length' => 9, + 'not null' => TRUE, + 'default' => '', + 'description' => t('Message status. Core understands pass, fail, exception.'), + ), + 'message' => array( + 'type' => 'varchar', + 'length' => 255, + 'not null' => TRUE, + 'default' => '', + 'description' => t('The message itself.'), + ), + 'message_group' => array( + 'type' => 'varchar', + 'length' => 255, + 'not null' => TRUE, + 'default' => '', + 'description' => t('The message group this message belongs to. For example: warning, browser, user.'), + ), + 'caller' => array( + 'type' => 'varchar', + 'length' => 255, + 'not null' => TRUE, + 'default' => '', + 'description' => t('Name of the caller function or method that created this message.'), + ), + 'line' => array( + 'type' => 'int', + 'not null' => TRUE, + 'default' => 0, + 'description' => t('Line number of the caller.'), + ), + 'file' => array( + 'type' => 'varchar', + 'length' => 255, + 'not null' => TRUE, + 'default' => '', + 'description' => t('Name of the file where the caller is.'), + ), + ), + 'primary key' => array('message_id'), + 'indexes' => array( + 'reporter' => array('test_class, message_id'), + ), + ); + $schema['simpletest_test_id'] = array( + 'description' => t('Stores simpletest test IDs.'), + 'fields' => array( + 'message_id' => array( + 'type' => 'serial', + 'not null' => TRUE, + 'description' => t('Primary Key: Unique simpletest ID.'), + ), + ), + 'primary key' => array('message_id'), + ); + return $schema; +} + +/** + * Create the simpletest tables. + */ +function simpletest_update_7000() { + $ret = array(); + $schema = array(); + + $schema['simpletest'] = array( + 'fields' => array( + 'message_id' => array('type' => 'serial', 'not null' => TRUE), + 'test_id' => array('type' => 'int', 'not null' => TRUE, 'default' => 0), + 'test_class' => array('type' => 'varchar', 'length' => 255, 'not null' => TRUE, 'default' => ''), + 'status' => array('type' => 'varchar', 'length' => 9, 'not null' => TRUE, 'default' => ''), + 'message' => array('type' => 'varchar', 'length' => 255, 'not null' => TRUE, 'default' => ''), + 'message_group' => array('type' => 'varchar', 'length' => 255, 'not null' => TRUE, 'default' => ''), + 'caller' => array('type' => 'varchar', 'length' => 255, 'not null' => TRUE, 'default' => ''), + 'line' => array('type' => 'int', 'not null' => TRUE, 'default' => 0), + 'file' => array('type' => 'varchar', 'length' => 255, 'not null' => TRUE, 'default' => ''), + ), + 'primary key' => array('message_id'), + 'indexes' => array( + 'reporter' => array('test_class, message_id'), + ), + ); + + $schema['simpletest_test_id'] = array( + 'fields' => array( + 'message_id' => array('type' => 'serial', 'not null' => TRUE), + ), + 'primary key' => array('message_id'), + ); + + foreach ($schema as $name => $definition) { + db_create_table($ret, $name, $definition); + } + + return $ret; +}
\ No newline at end of file |