<?php

/**
 * @file
 * Install, update and uninstall functions for the update_script_test module.
 */

/**
 * Implements hook_requirements().
 */
function update_script_test_requirements($phase) {
  $requirements = [];

  if ($phase == 'update') {
    // Set a requirements warning or error when the test requests it.
    $requirement_type = \Drupal::config('update_script_test.settings')->get('requirement_type');
    switch ($requirement_type) {
      case REQUIREMENT_WARNING:
        $requirements['update_script_test'] = [
          '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'] = [
          'title' => 'Update script test',
          'value' => 'Error',
          'description' => 'This is a requirements error provided by the update_script_test module.',
          'severity' => REQUIREMENT_ERROR,
        ];
        break;
    }
  }

  return $requirements;
}

/**
 * Implements hook_update_last_removed().
 */
function update_script_test_update_last_removed() {
  return 7110;
}

/**
 * Dummy update_script_test update 7200.
 */
function update_script_test_update_7200() {
  return 'The update_script_test_update_7200() update was executed successfully.';
}

/**
 * Dummy update_script_test update 7201.
 */
function update_script_test_update_7201() {
  return 'The update_script_test_update_7201() update was executed successfully.';
}

/**
 * Dummy update function to run during the tests.
 */
function update_script_test_update_8001() {
  return 'The update_script_test_update_8001() update was executed successfully.';
}
