You are here

config_import_test.module in Drupal 9

Provides configuration import test helpers.

File

core/modules/config/tests/config_import_test/config_import_test.module
View source
<?php

/**
 * @file
 * Provides configuration import test helpers.
 */
use Drupal\Core\Config\ConfigImporter;

/**
 * Implements hook_config_import_steps_alter().
 */
function config_import_test_config_import_steps_alter(&$sync_steps) {
  $sync_steps[] = '_config_import_test_config_import_steps_alter';
}

/**
 * Implements configuration synchronization step added by an alter for testing.
 *
 * @param array $context
 *   The batch context.
 * @param \Drupal\Core\Config\ConfigImporter $config_importer
 *   The configuration importer.
 */
function _config_import_test_config_import_steps_alter(&$context, ConfigImporter $config_importer) {
  $GLOBALS['hook_config_test']['config_import_steps_alter'] = TRUE;
  if (\Drupal::state()
    ->get('config_import_steps_alter.error', FALSE)) {
    $context['results']['errors'][] = '_config_import_test_config_import_steps_alter batch error';
    $config_importer
      ->logError('_config_import_test_config_import_steps_alter ConfigImporter error');
  }
  $context['finished'] = 1;
}

Functions

Namesort descending Description
config_import_test_config_import_steps_alter Implements hook_config_import_steps_alter().
_config_import_test_config_import_steps_alter Implements configuration synchronization step added by an alter for testing.