danielebarchiesi@0: $t('cURL'),
danielebarchiesi@0: 'value' => $has_curl ? $t('Enabled') : $t('Not found'),
danielebarchiesi@0: );
danielebarchiesi@0: if (!$has_curl) {
danielebarchiesi@0: $requirements['curl']['severity'] = REQUIREMENT_ERROR;
danielebarchiesi@0: $requirements['curl']['description'] = $t('The testing framework could not be installed because the PHP cURL library is not available.', array('@curl_url' => 'http://php.net/manual/en/curl.setup.php'));
danielebarchiesi@0: }
danielebarchiesi@0: $requirements['hash'] = array(
danielebarchiesi@0: 'title' => $t('hash'),
danielebarchiesi@0: 'value' => $has_hash ? $t('Enabled') : $t('Not found'),
danielebarchiesi@0: );
danielebarchiesi@0: if (!$has_hash) {
danielebarchiesi@0: $requirements['hash']['severity'] = REQUIREMENT_ERROR;
danielebarchiesi@0: $requirements['hash']['description'] = $t('The testing framework could not be installed because the PHP hash extension is disabled.', array('@hash_url' => 'http://php.net/manual/en/book.hash.php'));
danielebarchiesi@0: }
danielebarchiesi@0:
danielebarchiesi@0: $requirements['php_domdocument'] = array(
danielebarchiesi@0: 'title' => $t('PHP DOMDocument class'),
danielebarchiesi@0: 'value' => $has_domdocument ? $t('Enabled') : $t('Not found'),
danielebarchiesi@0: );
danielebarchiesi@0: if (!$has_domdocument) {
danielebarchiesi@0: $requirements['php_domdocument']['severity'] = REQUIREMENT_ERROR;
danielebarchiesi@0: $requirements['php_domdocument']['description'] = $t('The testing framework requires the DOMDocument class to be available. Check the configure command at the PHP info page.', array('@link-phpinfo' => url('admin/reports/status/php')));
danielebarchiesi@0: }
danielebarchiesi@0:
danielebarchiesi@0: // SimpleTest currently needs 2 cURL options which are incompatible with
danielebarchiesi@0: // having PHP's open_basedir restriction set.
danielebarchiesi@0: // See http://drupal.org/node/674304.
danielebarchiesi@0: $requirements['php_open_basedir'] = array(
danielebarchiesi@0: 'title' => $t('PHP open_basedir restriction'),
danielebarchiesi@0: 'value' => $open_basedir ? $t('Enabled') : $t('Disabled'),
danielebarchiesi@0: );
danielebarchiesi@0: if ($open_basedir) {
danielebarchiesi@0: $requirements['php_open_basedir']['severity'] = REQUIREMENT_ERROR;
danielebarchiesi@0: $requirements['php_open_basedir']['description'] = $t('The testing framework requires the PHP open_basedir restriction to be disabled. Check your webserver configuration or contact your web host.', array('@open_basedir-url' => 'http://php.net/manual/en/ini.core.php#ini.open-basedir'));
danielebarchiesi@0: }
danielebarchiesi@0:
danielebarchiesi@0: // Check the current memory limit. If it is set too low, SimpleTest will fail
danielebarchiesi@0: // to load all tests and throw a fatal error.
danielebarchiesi@0: $memory_limit = ini_get('memory_limit');
danielebarchiesi@0: if (!drupal_check_memory_limit(SIMPLETEST_MINIMUM_PHP_MEMORY_LIMIT, $memory_limit)) {
danielebarchiesi@0: $requirements['php_memory_limit']['severity'] = REQUIREMENT_ERROR;
danielebarchiesi@0: $requirements['php_memory_limit']['description'] = $t('The testing framework requires the PHP memory limit to be at least %memory_minimum_limit. The current value is %memory_limit. Follow these steps to continue.', array('%memory_limit' => $memory_limit, '%memory_minimum_limit' => SIMPLETEST_MINIMUM_PHP_MEMORY_LIMIT, '@url' => 'http://drupal.org/node/207036'));
danielebarchiesi@0: }
danielebarchiesi@0:
danielebarchiesi@0: return $requirements;
danielebarchiesi@0: }
danielebarchiesi@0:
danielebarchiesi@0: /**
danielebarchiesi@0: * Implements hook_schema().
danielebarchiesi@0: */
danielebarchiesi@0: function simpletest_schema() {
danielebarchiesi@0: $schema['simpletest'] = array(
danielebarchiesi@0: 'description' => 'Stores simpletest messages',
danielebarchiesi@0: 'fields' => array(
danielebarchiesi@0: 'message_id' => array(
danielebarchiesi@0: 'type' => 'serial',
danielebarchiesi@0: 'not null' => TRUE,
danielebarchiesi@0: 'description' => 'Primary Key: Unique simpletest message ID.',
danielebarchiesi@0: ),
danielebarchiesi@0: 'test_id' => array(
danielebarchiesi@0: 'type' => 'int',
danielebarchiesi@0: 'not null' => TRUE,
danielebarchiesi@0: 'default' => 0,
danielebarchiesi@0: 'description' => 'Test ID, messages belonging to the same ID are reported together',
danielebarchiesi@0: ),
danielebarchiesi@0: 'test_class' => array(
danielebarchiesi@0: 'type' => 'varchar',
danielebarchiesi@0: 'length' => 255,
danielebarchiesi@0: 'not null' => TRUE,
danielebarchiesi@0: 'default' => '',
danielebarchiesi@0: 'description' => 'The name of the class that created this message.',
danielebarchiesi@0: ),
danielebarchiesi@0: 'status' => array(
danielebarchiesi@0: 'type' => 'varchar',
danielebarchiesi@0: 'length' => 9,
danielebarchiesi@0: 'not null' => TRUE,
danielebarchiesi@0: 'default' => '',
danielebarchiesi@0: 'description' => 'Message status. Core understands pass, fail, exception.',
danielebarchiesi@0: ),
danielebarchiesi@0: 'message' => array(
danielebarchiesi@0: 'type' => 'text',
danielebarchiesi@0: 'not null' => TRUE,
danielebarchiesi@0: 'description' => 'The message itself.',
danielebarchiesi@0: ),
danielebarchiesi@0: 'message_group' => array(
danielebarchiesi@0: 'type' => 'varchar',
danielebarchiesi@0: 'length' => 255,
danielebarchiesi@0: 'not null' => TRUE,
danielebarchiesi@0: 'default' => '',
danielebarchiesi@0: 'description' => 'The message group this message belongs to. For example: warning, browser, user.',
danielebarchiesi@0: ),
danielebarchiesi@0: 'function' => array(
danielebarchiesi@0: 'type' => 'varchar',
danielebarchiesi@0: 'length' => 255,
danielebarchiesi@0: 'not null' => TRUE,
danielebarchiesi@0: 'default' => '',
danielebarchiesi@0: 'description' => 'Name of the assertion function or method that created this message.',
danielebarchiesi@0: ),
danielebarchiesi@0: 'line' => array(
danielebarchiesi@0: 'type' => 'int',
danielebarchiesi@0: 'not null' => TRUE,
danielebarchiesi@0: 'default' => 0,
danielebarchiesi@0: 'description' => 'Line number on which the function is called.',
danielebarchiesi@0: ),
danielebarchiesi@0: 'file' => array(
danielebarchiesi@0: 'type' => 'varchar',
danielebarchiesi@0: 'length' => 255,
danielebarchiesi@0: 'not null' => TRUE,
danielebarchiesi@0: 'default' => '',
danielebarchiesi@0: 'description' => 'Name of the file where the function is called.',
danielebarchiesi@0: ),
danielebarchiesi@0: ),
danielebarchiesi@0: 'primary key' => array('message_id'),
danielebarchiesi@0: 'indexes' => array(
danielebarchiesi@0: 'reporter' => array('test_class', 'message_id'),
danielebarchiesi@0: ),
danielebarchiesi@0: );
danielebarchiesi@0: $schema['simpletest_test_id'] = array(
danielebarchiesi@0: 'description' => 'Stores simpletest test IDs, used to auto-incrament the test ID so that a fresh test ID is used.',
danielebarchiesi@0: 'fields' => array(
danielebarchiesi@0: 'test_id' => array(
danielebarchiesi@0: 'type' => 'serial',
danielebarchiesi@0: 'not null' => TRUE,
danielebarchiesi@0: 'description' => 'Primary Key: Unique simpletest ID used to group test results together. Each time a set of tests
danielebarchiesi@0: are run a new test ID is used.',
danielebarchiesi@0: ),
danielebarchiesi@0: 'last_prefix' => array(
danielebarchiesi@0: 'type' => 'varchar',
danielebarchiesi@0: 'length' => 60,
danielebarchiesi@0: 'not null' => FALSE,
danielebarchiesi@0: 'default' => '',
danielebarchiesi@0: 'description' => 'The last database prefix used during testing.',
danielebarchiesi@0: ),
danielebarchiesi@0: ),
danielebarchiesi@0: 'primary key' => array('test_id'),
danielebarchiesi@0: );
danielebarchiesi@0: return $schema;
danielebarchiesi@0: }
danielebarchiesi@0:
danielebarchiesi@0: /**
danielebarchiesi@0: * Implements hook_uninstall().
danielebarchiesi@0: */
danielebarchiesi@0: function simpletest_uninstall() {
danielebarchiesi@0: drupal_load('module', 'simpletest');
danielebarchiesi@0: simpletest_clean_database();
danielebarchiesi@0:
danielebarchiesi@0: // Remove settings variables.
danielebarchiesi@0: variable_del('simpletest_httpauth_method');
danielebarchiesi@0: variable_del('simpletest_httpauth_username');
danielebarchiesi@0: variable_del('simpletest_httpauth_password');
danielebarchiesi@0: variable_del('simpletest_clear_results');
danielebarchiesi@0: variable_del('simpletest_verbose');
danielebarchiesi@0:
danielebarchiesi@0: // Remove generated files.
danielebarchiesi@0: file_unmanaged_delete_recursive('public://simpletest');
danielebarchiesi@0: }