5 * Module for testing Update Manager functionality.
8 use Drupal\Core\Extension\Extension;
11 * Implements hook_system_info_alter().
13 * Checks the 'update_test.settings:system_info' configuration and sees if we
14 * need to alter the system info for the given $file based on the setting. The
15 * setting is expected to be a nested associative array. If the key '#all' is
16 * defined, its subarray will include .info.yml keys and values for all modules
17 * and themes on the system. Otherwise, the settings array is keyed by the
18 * module or theme short name ($file->name) and the subarrays contain settings
19 * just for that module or theme.
21 function update_test_system_info_alter(&$info, Extension $file) {
22 $setting = \Drupal::config('update_test.settings')->get('system_info');
23 foreach (['#all', $file->getName()] as $id) {
24 if (!empty($setting[$id])) {
25 foreach ($setting[$id] as $key => $value) {
33 * Implements hook_update_status_alter().
35 * Checks the 'update_test.settings:update_status' configuration and sees if we
36 * need to alter the update status for the given project based on the setting.
37 * The setting is expected to be a nested associative array. If the key '#all'
38 * is defined, its subarray will include .info.yml keys and values for all modules
39 * and themes on the system. Otherwise, the settings array is keyed by the
40 * module or theme short name and the subarrays contain settings just for that
43 function update_test_update_status_alter(&$projects) {
44 $setting = \Drupal::config('update_test.settings')->get('update_status');
45 if (!empty($setting)) {
46 foreach ($projects as $project_name => &$project) {
47 foreach (['#all', $project_name] as $id) {
48 if (!empty($setting[$id])) {
49 foreach ($setting[$id] as $key => $value) {
50 $project[$key] = $value;
59 * Implements hook_filetransfer_info().
61 function update_test_filetransfer_info() {
62 // Define a test file transfer method, to ensure that there will always be at
63 // least one method available in the user interface (regardless of the
64 // environment in which the update manager tests are run).
67 'title' => t('Update Test FileTransfer'),
68 'class' => 'Drupal\update_test\TestFileTransferWithSettingsForm',