function update_script_test_requirements

Same name in other branches
  1. 9 core/modules/system/tests/modules/update_script_test/update_script_test.install \update_script_test_requirements()
  2. 8.9.x core/modules/system/tests/modules/update_script_test/update_script_test.install \update_script_test_requirements()
  3. 10 core/modules/system/tests/modules/update_script_test/update_script_test.install \update_script_test_requirements()
  4. 11.x core/modules/system/tests/modules/update_script_test/update_script_test.install \update_script_test_requirements()

Implements hook_requirements().

File

modules/simpletest/tests/update_script_test.install, line 11

Code

function update_script_test_requirements($phase) {
    $requirements = array();
    if ($phase == 'update') {
        // Set a requirements warning or error when the test requests it.
        $requirement_type = variable_get('update_script_test_requirement_type');
        switch ($requirement_type) {
            case REQUIREMENT_WARNING:
                $requirements['update_script_test'] = array(
                    'title' => 'Update script test',
                    'value' => 'Warning',
                    'description' => 'This is a requirements warning provided by the update_script_test module.',
                    'severity' => REQUIREMENT_WARNING,
                );
                break;
            case REQUIREMENT_ERROR:
                $requirements['update_script_test'] = array(
                    'title' => 'Update script test',
                    'value' => 'Error',
                    'description' => 'This is a requirements error provided by the update_script_test module.',
                    'severity' => REQUIREMENT_ERROR,
                );
                break;
            case REQUIREMENT_INFO:
                $requirements['update_script_test_stop'] = array(
                    'title' => 'Update script test stop',
                    'value' => 'Error',
                    'description' => 'This is a requirements error provided by the update_script_test module to stop the page redirect for the info.',
                    'severity' => REQUIREMENT_ERROR,
                );
                $requirements['update_script_test'] = array(
                    'title' => 'Update script test',
                    'description' => 'This is a requirements info provided by the update_script_test module.',
                    'severity' => REQUIREMENT_INFO,
                );
                break;
        }
    }
    return $requirements;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.