You are here

update_script_test.module in Drupal 10

This file provides testing functionality for update.php.

File

core/modules/system/tests/modules/update_script_test/update_script_test.module
View source
<?php

/**
 * @file
 * This file provides testing functionality for update.php.
 */
use Drupal\Core\Extension\Extension;

/**
 * Implements hook_cache_flush().
 *
 * This sets a message to confirm that all caches are cleared whenever
 * update.php completes.
 *
 * @see UpdateScriptFunctionalTest::testRequirements()
 */
function update_script_test_cache_flush() {
  \Drupal::messenger()
    ->addStatus(t('hook_cache_flush() invoked for update_script_test.module.'));
}

/**
 * Implements hook_system_info_alter().
 */
function update_script_test_system_info_alter(array &$info, Extension $file, $type) {
  $new_info = \Drupal::state()
    ->get('update_script_test.system_info_alter');
  if ($new_info) {
    if ($file
      ->getName() == 'update_script_test') {
      $info = $new_info + $info;
    }
  }
}