Update to drupal 8.0.0-rc1. For more information, see https://www.drupal.org/node/2582663
This commit is contained in:
parent
eb34d130a8
commit
f32e58e4b1
8476 changed files with 211648 additions and 170042 deletions
|
@ -3,32 +3,32 @@ config.sync:
|
|||
base_route: config.sync
|
||||
title: 'Synchronize'
|
||||
|
||||
config.full:
|
||||
config.import:
|
||||
route_name: config.import_full
|
||||
title: 'Full Import/Export'
|
||||
title: 'Import'
|
||||
base_route: config.sync
|
||||
|
||||
config.single:
|
||||
route_name: config.import_single
|
||||
title: 'Single Import/Export'
|
||||
config.export:
|
||||
route_name: config.export_full
|
||||
title: 'Export'
|
||||
base_route: config.sync
|
||||
|
||||
config.export_full:
|
||||
route_name: config.export_full
|
||||
title: Export
|
||||
parent_id: config.full
|
||||
title: Full archive
|
||||
parent_id: config.export
|
||||
|
||||
config.import_full:
|
||||
route_name: config.import_full
|
||||
title: Import
|
||||
parent_id: config.full
|
||||
title: Full archive
|
||||
parent_id: config.import
|
||||
|
||||
config.export_single:
|
||||
route_name: config.export_single
|
||||
title: Export
|
||||
parent_id: config.single
|
||||
title: Single item
|
||||
parent_id: config.export
|
||||
|
||||
config.import_single:
|
||||
route_name: config.import_single
|
||||
title: Import
|
||||
parent_id: config.single
|
||||
title: Single item
|
||||
parent_id: config.import
|
||||
|
|
|
@ -15,45 +15,45 @@ function config_help($route_name, RouteMatchInterface $route_match) {
|
|||
case 'help.page.config':
|
||||
$output = '';
|
||||
$output .= '<h3>' . t('About') . '</h3>';
|
||||
$output .= '<p>' . t('The Configuration Manager module provides a user interface for importing and exporting configuration changes between installations of your website in different environments. Configuration is stored in YAML format. For more information, see the <a href="!url">online documentation for the Configuration Manager module</a>.', array('!url' => 'https://www.drupal.org/documentation/administer/config')) . '</p>';
|
||||
$output .= '<p>' . t('The Configuration Manager module provides a user interface for importing and exporting configuration changes between installations of your website in different environments. Configuration is stored in YAML format. For more information, see the <a href=":url">online documentation for the Configuration Manager module</a>.', array(':url' => 'https://www.drupal.org/documentation/administer/config')) . '</p>';
|
||||
$output .= '<h3>' . t('Uses') . '</h3>';
|
||||
$output .= '<dl>';
|
||||
$output .= '<dt>' . t('Exporting the full configuration') . '</dt>';
|
||||
$output .= '<dd>' . t('You can create and download an archive consisting of all your site\'s configuration exported as <em>*.yml</em> files on the <a href="!url">Export</a> page.' , array('!url' => \Drupal::url('config.export_full'))) . '</dd>';
|
||||
$output .= '<dd>' . t('You can create and download an archive consisting of all your site\'s configuration exported as <em>*.yml</em> files on the <a href=":url">Export</a> page.' , array(':url' => \Drupal::url('config.export_full'))) . '</dd>';
|
||||
$output .= '<dt>' . t('Importing a full configuration') . '</dt>';
|
||||
$output .= '<dd>' . t('You can upload a full site configuration from an archive file on the <a href="!url">Import</a> page. When importing data from a different environment, the site and import files must have matching configuration values for UUID in the <em>system.site</em> configuration item. That means that your other environments should initially be set up as clones of the target site. Migrations are not supported.', array('!url' => \Drupal::url('config.import_full'))) . '</dd>';
|
||||
$output .= '<dd>' . t('You can upload a full site configuration from an archive file on the <a href=":url">Import</a> page. When importing data from a different environment, the site and import files must have matching configuration values for UUID in the <em>system.site</em> configuration item. That means that your other environments should initially be set up as clones of the target site. Migrations are not supported.', array(':url' => \Drupal::url('config.import_full'))) . '</dd>';
|
||||
$output .= '<dt>' . t('Synchronizing configuration'). '</dt>';
|
||||
$output .= '<dd>' . t('You can review differences between the active configuration and an imported configuration archive on the <a href="!synchronize">Synchronize</a> page to ensure that the changes are as expected, before finalizing the import. The Synchronize page also shows configuration items that would be added or removed.', array('!synchronize' => \Drupal::url('config.sync'))) . '</dd>';
|
||||
$output .= '<dd>' . t('You can review differences between the active configuration and an imported configuration archive on the <a href=":synchronize">Synchronize</a> page to ensure that the changes are as expected, before finalizing the import. The Synchronize page also shows configuration items that would be added or removed.', array(':synchronize' => \Drupal::url('config.sync'))) . '</dd>';
|
||||
$output .= '<dt>' . t('Exporting a single configuration item') . '</dt>';
|
||||
$output .= '<dd>' . t('You can export a single configuration item by selecting a <em>Configuration type</em> and <em>Configuration name</em> on the <a href="!single-export">Single export</a> page. The configuration and its corresponding <em>*.yml file name</em> are then displayed on the page for you to copy.', array('!single-export' => \Drupal::url('config.export_single'))) . '</dd>';
|
||||
$output .= '<dd>' . t('You can export a single configuration item by selecting a <em>Configuration type</em> and <em>Configuration name</em> on the <a href=":single-export">Single export</a> page. The configuration and its corresponding <em>*.yml file name</em> are then displayed on the page for you to copy.', array(':single-export' => \Drupal::url('config.export_single'))) . '</dd>';
|
||||
$output .= '<dt>' . t('Importing a single configuration item') . '</dt>';
|
||||
$output .= '<dd>' . t('You can import a single configuration item by pasting it in YAML format into the form on the <a href="!single-import">Single import</a> page.', array('!single-import' => \Drupal::url('config.import_single'))) . '</dd>';
|
||||
$output .= '<dd>' . t('You can import a single configuration item by pasting it in YAML format into the form on the <a href=":single-import">Single import</a> page.', array(':single-import' => \Drupal::url('config.import_single'))) . '</dd>';
|
||||
$output .= '</dl>';
|
||||
return $output;
|
||||
|
||||
case 'config.sync':
|
||||
$output = '';
|
||||
$output .= '<p>' . t('Import configuration that is placed in your staging directory. All changes, deletions, renames, and additions are listed below.') . '</p>';
|
||||
$output .= '<p>' . t('Compare the configuration uploaded to your sync directory with the active configuration before completing the import.') . '</p>';
|
||||
return $output;
|
||||
|
||||
case 'config.export_full':
|
||||
$output = '';
|
||||
$output .= '<p>' . t('The full export page can be used to export the full configuration of this site, and download it as a gzipped tar file.') . '</p>';
|
||||
$output .= '<p>' . t('Export and download the full configuration of this site as a gzipped tar file.') . '</p>';
|
||||
return $output;
|
||||
|
||||
case 'config.import_full':
|
||||
$output = '';
|
||||
$output .= '<p>' . t('The full import page can be used to import a full set of configuration for this site by uploading a gzipped or bzipped tar file consisting of all configuration YAML files. The results will be placed in a the staging directory, so they can be compared in the Synchronize tab. There the import can be finalized.') . '</p>';
|
||||
$output .= '<p>' . t('Upload a full site configuration archive to the sync directory. It can then be compared and imported on the Synchronize page.') . '</p>';
|
||||
return $output;
|
||||
|
||||
case 'config.export_single':
|
||||
$output = '';
|
||||
$output .= '<p>' . t('The single export page can be used to display a single configuration item in a YAML structure.') . '</p>';
|
||||
$output .= '<p>' . t('Choose a configuration item to display its YAML structure.') . '</p>';
|
||||
return $output;
|
||||
|
||||
case 'config.import_single':
|
||||
$output = '';
|
||||
$output .= '<p>' . t('The single import page can be used to import a single configuration item by pasting a YAML structure into the text field.') . '</p>';
|
||||
$output .= '<p>' . t('Import a single configuration item by pasting its YAML structure into the text field.') . '</p>';
|
||||
return $output;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -64,7 +64,7 @@ class ConfigController implements ContainerInjectionInterface {
|
|||
public static function create(ContainerInterface $container) {
|
||||
return new static(
|
||||
$container->get('config.storage'),
|
||||
$container->get('config.storage.staging'),
|
||||
$container->get('config.storage.sync'),
|
||||
$container->get('config.manager'),
|
||||
new FileDownloadController(),
|
||||
$container->get('diff.formatter')
|
||||
|
@ -143,8 +143,8 @@ class ConfigController implements ContainerInjectionInterface {
|
|||
$build['diff'] = array(
|
||||
'#type' => 'table',
|
||||
'#header' => array(
|
||||
array('data' => t('Old'), 'colspan' => '2'),
|
||||
array('data' => t('New'), 'colspan' => '2'),
|
||||
array('data' => t('Active'), 'colspan' => '2'),
|
||||
array('data' => t('Staged'), 'colspan' => '2'),
|
||||
),
|
||||
'#rows' => $this->diffFormatter->format($diff),
|
||||
);
|
||||
|
|
|
@ -26,9 +26,6 @@ class ConfigExportForm extends FormBase {
|
|||
* {@inheritdoc}
|
||||
*/
|
||||
public function buildForm(array $form, FormStateInterface $form_state) {
|
||||
$form['description'] = array(
|
||||
'#markup' => '<p>' . $this->t('Use the export button below to download your site configuration.') . '</p>',
|
||||
);
|
||||
$form['submit'] = array(
|
||||
'#type' => 'submit',
|
||||
'#value' => $this->t('Export'),
|
||||
|
|
|
@ -40,7 +40,7 @@ class ConfigImportForm extends FormBase {
|
|||
*/
|
||||
public static function create(ContainerInterface $container) {
|
||||
return new static(
|
||||
$container->get('config.storage.staging')
|
||||
$container->get('config.storage.sync')
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -93,7 +93,7 @@ class ConfigImportForm extends FormBase {
|
|||
foreach ($archiver->listContent() as $file) {
|
||||
$files[] = $file['filename'];
|
||||
}
|
||||
$archiver->extractList($files, config_get_config_directory(CONFIG_STAGING_DIRECTORY));
|
||||
$archiver->extractList($files, config_get_config_directory(CONFIG_SYNC_DIRECTORY));
|
||||
drupal_set_message($this->t('Your configuration files were successfully uploaded and are ready for import.'));
|
||||
$form_state->setRedirect('config.sync');
|
||||
}
|
||||
|
|
|
@ -105,7 +105,6 @@ class ConfigSingleExportForm extends FormBase {
|
|||
'#type' => 'select',
|
||||
'#options' => $this->findConfiguration($default_type),
|
||||
'#default_value' => $config_name,
|
||||
'#required' => TRUE,
|
||||
'#prefix' => '<div id="edit-config-type-wrapper">',
|
||||
'#suffix' => '</div>',
|
||||
'#ajax' => array(
|
||||
|
@ -118,7 +117,6 @@ class ConfigSingleExportForm extends FormBase {
|
|||
'#title' => $this->t('Here is your configuration:'),
|
||||
'#type' => 'textarea',
|
||||
'#rows' => 24,
|
||||
'#required' => TRUE,
|
||||
'#prefix' => '<div id="edit-export-wrapper">',
|
||||
'#suffix' => '</div>',
|
||||
);
|
||||
|
|
|
@ -39,11 +39,11 @@ class ConfigSync extends FormBase {
|
|||
protected $lock;
|
||||
|
||||
/**
|
||||
* The staging configuration object.
|
||||
* The sync configuration object.
|
||||
*
|
||||
* @var \Drupal\Core\Config\StorageInterface
|
||||
*/
|
||||
protected $stagingStorage;
|
||||
protected $syncStorage;
|
||||
|
||||
/**
|
||||
* The active configuration object.
|
||||
|
@ -111,7 +111,7 @@ class ConfigSync extends FormBase {
|
|||
/**
|
||||
* Constructs the object.
|
||||
*
|
||||
* @param \Drupal\Core\Config\StorageInterface $staging_storage
|
||||
* @param \Drupal\Core\Config\StorageInterface $sync_storage
|
||||
* The source storage.
|
||||
* @param \Drupal\Core\Config\StorageInterface $active_storage
|
||||
* The target storage.
|
||||
|
@ -134,8 +134,8 @@ class ConfigSync extends FormBase {
|
|||
* @param \Drupal\Core\Render\RendererInterface
|
||||
* The renderer.
|
||||
*/
|
||||
public function __construct(StorageInterface $staging_storage, StorageInterface $active_storage, StorageInterface $snapshot_storage, LockBackendInterface $lock, EventDispatcherInterface $event_dispatcher, ConfigManagerInterface $config_manager, TypedConfigManagerInterface $typed_config, ModuleHandlerInterface $module_handler, ModuleInstallerInterface $module_installer, ThemeHandlerInterface $theme_handler, RendererInterface $renderer) {
|
||||
$this->stagingStorage = $staging_storage;
|
||||
public function __construct(StorageInterface $sync_storage, StorageInterface $active_storage, StorageInterface $snapshot_storage, LockBackendInterface $lock, EventDispatcherInterface $event_dispatcher, ConfigManagerInterface $config_manager, TypedConfigManagerInterface $typed_config, ModuleHandlerInterface $module_handler, ModuleInstallerInterface $module_installer, ThemeHandlerInterface $theme_handler, RendererInterface $renderer) {
|
||||
$this->syncStorage = $sync_storage;
|
||||
$this->activeStorage = $active_storage;
|
||||
$this->snapshotStorage = $snapshot_storage;
|
||||
$this->lock = $lock;
|
||||
|
@ -153,7 +153,7 @@ class ConfigSync extends FormBase {
|
|||
*/
|
||||
public static function create(ContainerInterface $container) {
|
||||
return new static(
|
||||
$container->get('config.storage.staging'),
|
||||
$container->get('config.storage.sync'),
|
||||
$container->get('config.storage'),
|
||||
$container->get('config.storage.snapshot'),
|
||||
$container->get('lock.persistent'),
|
||||
|
@ -183,8 +183,8 @@ class ConfigSync extends FormBase {
|
|||
'#type' => 'submit',
|
||||
'#value' => $this->t('Import all'),
|
||||
);
|
||||
$source_list = $this->stagingStorage->listAll();
|
||||
$storage_comparer = new StorageComparer($this->stagingStorage, $this->activeStorage, $this->configManager);
|
||||
$source_list = $this->syncStorage->listAll();
|
||||
$storage_comparer = new StorageComparer($this->syncStorage, $this->activeStorage, $this->configManager);
|
||||
if (empty($source_list) || !$storage_comparer->createChangelist()->hasChanges()) {
|
||||
$form['no_changes'] = array(
|
||||
'#type' => 'table',
|
||||
|
@ -217,12 +217,16 @@ class ConfigSync extends FormBase {
|
|||
}
|
||||
}
|
||||
sort($change_list);
|
||||
$change_list_render = array(
|
||||
'#theme' => 'item_list',
|
||||
'#items' => $change_list,
|
||||
);
|
||||
$change_list_html = $this->renderer->renderPlain($change_list_render);
|
||||
drupal_set_message($this->t('The following items in your active configuration have changes since the last import that may be lost on the next import. !changes', array('!changes' => $change_list_html)), 'warning');
|
||||
$message = [
|
||||
[
|
||||
'#markup' => $this->t('The following items in your active configuration have changes since the last import that may be lost on the next import.')
|
||||
],
|
||||
[
|
||||
'#theme' => 'item_list',
|
||||
'#items' => $change_list,
|
||||
]
|
||||
];
|
||||
drupal_set_message($this->renderer->renderPlain($message), 'warning');
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -237,7 +241,7 @@ class ConfigSync extends FormBase {
|
|||
$form[$collection]['collection_heading'] = array(
|
||||
'#type' => 'html_tag',
|
||||
'#tag' => 'h2',
|
||||
'#value' => $this->t('!collection configuration collection', array('!collection' => $collection)),
|
||||
'#value' => $this->t('@collection configuration collection', array('@collection' => $collection)),
|
||||
);
|
||||
}
|
||||
foreach ($storage_comparer->getChangelist(NULL, $collection) as $config_change_type => $config_names) {
|
||||
|
@ -277,7 +281,7 @@ class ConfigSync extends FormBase {
|
|||
if ($config_change_type == 'rename') {
|
||||
$names = $storage_comparer->extractRenameNames($config_name);
|
||||
$route_options = array('source_name' => $names['old_name'], 'target_name' => $names['new_name']);
|
||||
$config_name = $this->t('!source_name to !target_name', array('!source_name' => $names['old_name'], '!target_name' => $names['new_name']));
|
||||
$config_name = $this->t('@source_name to @target_name', array('@source_name' => $names['old_name'], '@target_name' => $names['new_name']));
|
||||
}
|
||||
else {
|
||||
$route_options = array('source_name' => $config_name);
|
||||
|
|
|
@ -28,8 +28,8 @@ trait AssertConfigEntityImportTrait {
|
|||
$entity_uuid = $entity->uuid();
|
||||
$entity_type_id = $entity->getEntityTypeId();
|
||||
$original_data = $entity->toArray();
|
||||
// Copy everything to staging.
|
||||
$this->copyConfig(\Drupal::service('config.storage'), \Drupal::service('config.storage.staging'));
|
||||
// Copy everything to sync.
|
||||
$this->copyConfig(\Drupal::service('config.storage'), \Drupal::service('config.storage.sync'));
|
||||
// Delete the configuration from active. Don't worry about side effects of
|
||||
// deleting config like fields cleaning up field storages. The coming import
|
||||
// should recreate everything as necessary.
|
||||
|
|
|
@ -69,7 +69,8 @@ class ConfigDependencyTest extends EntityUnitTestBase {
|
|||
// Ensure that the provider of the config entity is not actually written to
|
||||
// the dependencies array.
|
||||
$raw_config = $this->config('config_test.dynamic.entity1');
|
||||
$this->assertTrue(array_search('node', $raw_config->get('dependencies.module')) !== FALSE, 'Node module is written to the dependencies array as this has to be explicit.');
|
||||
$root_module_dependencies = $raw_config->get('dependencies.module');
|
||||
$this->assertTrue(empty($root_module_dependencies), 'Node module is not written to the root dependencies array as it is enforced.');
|
||||
|
||||
// Create additional entities to test dependencies on config entities.
|
||||
$entity2 = $storage->create(array('id' => 'entity2', 'dependencies' => array('enforced' => array('config' => array($entity1->getConfigDependencyName())))));
|
||||
|
@ -301,10 +302,10 @@ class ConfigDependencyTest extends EntityUnitTestBase {
|
|||
$this->assertFalse($storage->load('entity1'), 'Entity 1 deleted');
|
||||
$entity2 = $storage->load('entity2');
|
||||
$this->assertTrue($entity2, 'Entity 2 not deleted');
|
||||
$this->assertEqual($entity2->calculateDependencies()['config'], array(), 'Entity 2 dependencies updated to remove dependency on Entity1.');
|
||||
$this->assertEqual($entity2->calculateDependencies()->getDependencies()['config'], array(), 'Entity 2 dependencies updated to remove dependency on Entity1.');
|
||||
$entity3 = $storage->load('entity3');
|
||||
$this->assertTrue($entity3, 'Entity 3 not deleted');
|
||||
$this->assertEqual($entity3->calculateDependencies()['config'], [$entity2->getConfigDependencyName()], 'Entity 3 still depends on Entity 2.');
|
||||
$this->assertEqual($entity3->calculateDependencies()->getDependencies()['config'], [$entity2->getConfigDependencyName()], 'Entity 3 still depends on Entity 2.');
|
||||
$this->assertFalse($storage->load('entity4'), 'Entity 4 deleted');
|
||||
}
|
||||
|
||||
|
@ -402,10 +403,10 @@ class ConfigDependencyTest extends EntityUnitTestBase {
|
|||
$this->assertFalse($storage->load('entity1'), 'Entity 1 deleted');
|
||||
$entity2 = $storage->load('entity2');
|
||||
$this->assertTrue($entity2, 'Entity 2 not deleted');
|
||||
$this->assertEqual($entity2->calculateDependencies()['config'], array(), 'Entity 2 dependencies updated to remove dependency on Entity1.');
|
||||
$this->assertEqual($entity2->calculateDependencies()->getDependencies()['config'], array(), 'Entity 2 dependencies updated to remove dependency on Entity1.');
|
||||
$entity3 = $storage->load('entity3');
|
||||
$this->assertTrue($entity3, 'Entity 3 not deleted');
|
||||
$this->assertEqual($entity3->calculateDependencies()['config'], [$entity2->getConfigDependencyName()], 'Entity 3 still depends on Entity 2.');
|
||||
$this->assertEqual($entity3->calculateDependencies()->getDependencies()['config'], [$entity2->getConfigDependencyName()], 'Entity 3 still depends on Entity 2.');
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -125,10 +125,10 @@ class ConfigDependencyWebTest extends WebTestBase {
|
|||
$this->assertFalse($storage->load('entity1'), 'Test entity 1 deleted');
|
||||
$entity2 = $storage->load('entity2');
|
||||
$this->assertTrue($entity2, 'Entity 2 not deleted');
|
||||
$this->assertEqual($entity2->calculateDependencies()['config'], array(), 'Entity 2 dependencies updated to remove dependency on Entity1.');
|
||||
$this->assertEqual($entity2->calculateDependencies()->getDependencies()['config'], array(), 'Entity 2 dependencies updated to remove dependency on Entity1.');
|
||||
$entity3 = $storage->load('entity3');
|
||||
$this->assertTrue($entity3, 'Entity 3 not deleted');
|
||||
$this->assertEqual($entity3->calculateDependencies()['config'], [$entity2->getConfigDependencyName()], 'Entity 3 still depends on Entity 2.');
|
||||
$this->assertEqual($entity3->calculateDependencies()->getDependencies()['config'], [$entity2->getConfigDependencyName()], 'Entity 3 still depends on Entity 2.');
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@ class ConfigDiffTest extends KernelTestBase {
|
|||
*/
|
||||
function testDiff() {
|
||||
$active = $this->container->get('config.storage');
|
||||
$staging = $this->container->get('config.storage.staging');
|
||||
$sync = $this->container->get('config.storage.sync');
|
||||
$config_name = 'config_test.system';
|
||||
$change_key = 'foo';
|
||||
$remove_key = '404';
|
||||
|
@ -43,44 +43,44 @@ class ConfigDiffTest extends KernelTestBase {
|
|||
// Install the default config.
|
||||
$this->installConfig(array('config_test'));
|
||||
|
||||
// Change a configuration value in staging.
|
||||
$staging_data = $original_data;
|
||||
$staging_data[$change_key] = $change_data;
|
||||
$staging_data[$add_key] = $add_data;
|
||||
$staging->write($config_name, $staging_data);
|
||||
// Change a configuration value in sync.
|
||||
$sync_data = $original_data;
|
||||
$sync_data[$change_key] = $change_data;
|
||||
$sync_data[$add_key] = $add_data;
|
||||
$sync->write($config_name, $sync_data);
|
||||
|
||||
// Verify that the diff reflects a change.
|
||||
$diff = \Drupal::service('config.manager')->diff($active, $staging, $config_name);
|
||||
$diff = \Drupal::service('config.manager')->diff($active, $sync, $config_name);
|
||||
$edits = $diff->getEdits();
|
||||
$this->assertEqual($edits[0]->type, 'change', 'The first item in the diff is a change.');
|
||||
$this->assertEqual($edits[0]->orig[0], $change_key . ': ' . $original_data[$change_key], format_string("The active value for key '%change_key' is '%original_data'.", array('%change_key' => $change_key, '%original_data' => $original_data[$change_key])));
|
||||
$this->assertEqual($edits[0]->closing[0], $change_key . ': ' . $change_data, format_string("The staging value for key '%change_key' is '%change_data'.", array('%change_key' => $change_key, '%change_data' => $change_data)));
|
||||
$this->assertEqual($edits[0]->closing[0], $change_key . ': ' . $change_data, format_string("The sync value for key '%change_key' is '%change_data'.", array('%change_key' => $change_key, '%change_data' => $change_data)));
|
||||
|
||||
// Reset data back to original, and remove a key
|
||||
$staging_data = $original_data;
|
||||
unset($staging_data[$remove_key]);
|
||||
$staging->write($config_name, $staging_data);
|
||||
$sync_data = $original_data;
|
||||
unset($sync_data[$remove_key]);
|
||||
$sync->write($config_name, $sync_data);
|
||||
|
||||
// Verify that the diff reflects a removed key.
|
||||
$diff = \Drupal::service('config.manager')->diff($active, $staging, $config_name);
|
||||
$diff = \Drupal::service('config.manager')->diff($active, $sync, $config_name);
|
||||
$edits = $diff->getEdits();
|
||||
$this->assertEqual($edits[0]->type, 'copy', 'The first item in the diff is a copy.');
|
||||
$this->assertEqual($edits[1]->type, 'delete', 'The second item in the diff is a delete.');
|
||||
$this->assertEqual($edits[1]->orig[0], $remove_key . ': ' . $original_data[$remove_key], format_string("The active value for key '%remove_key' is '%original_data'.", array('%remove_key' => $remove_key, '%original_data' => $original_data[$remove_key])));
|
||||
$this->assertFalse($edits[1]->closing, format_string("The key '%remove_key' does not exist in staging.", array('%remove_key' => $remove_key)));
|
||||
$this->assertFalse($edits[1]->closing, format_string("The key '%remove_key' does not exist in sync.", array('%remove_key' => $remove_key)));
|
||||
|
||||
// Reset data back to original and add a key
|
||||
$staging_data = $original_data;
|
||||
$staging_data[$add_key] = $add_data;
|
||||
$staging->write($config_name, $staging_data);
|
||||
$sync_data = $original_data;
|
||||
$sync_data[$add_key] = $add_data;
|
||||
$sync->write($config_name, $sync_data);
|
||||
|
||||
// Verify that the diff reflects an added key.
|
||||
$diff = \Drupal::service('config.manager')->diff($active, $staging, $config_name);
|
||||
$diff = \Drupal::service('config.manager')->diff($active, $sync, $config_name);
|
||||
$edits = $diff->getEdits();
|
||||
$this->assertEqual($edits[0]->type, 'copy', 'The first item in the diff is a copy.');
|
||||
$this->assertEqual($edits[1]->type, 'add', 'The second item in the diff is an add.');
|
||||
$this->assertFalse($edits[1]->orig, format_string("The key '%add_key' does not exist in active.", array('%add_key' => $add_key)));
|
||||
$this->assertEqual($edits[1]->closing[0], $add_key . ': ' . $add_data, format_string("The staging value for key '%add_key' is '%add_data'.", array('%add_key' => $add_key, '%add_data' => $add_data)));
|
||||
$this->assertEqual($edits[1]->closing[0], $add_key . ': ' . $add_data, format_string("The sync value for key '%add_key' is '%add_data'.", array('%add_key' => $add_key, '%add_data' => $add_data)));
|
||||
|
||||
// Test diffing a renamed config entity.
|
||||
$test_entity_id = $this->randomMachineName();
|
||||
|
@ -90,9 +90,9 @@ class ConfigDiffTest extends KernelTestBase {
|
|||
));
|
||||
$test_entity->save();
|
||||
$data = $active->read('config_test.dynamic.' . $test_entity_id);
|
||||
$staging->write('config_test.dynamic.' . $test_entity_id, $data);
|
||||
$sync->write('config_test.dynamic.' . $test_entity_id, $data);
|
||||
$config_name = 'config_test.dynamic.' . $test_entity_id;
|
||||
$diff = \Drupal::service('config.manager')->diff($active, $staging, $config_name, $config_name);
|
||||
$diff = \Drupal::service('config.manager')->diff($active, $sync, $config_name, $config_name);
|
||||
// Prove the fields match.
|
||||
$edits = $diff->getEdits();
|
||||
$this->assertEqual($edits[0]->type, 'copy', 'The first item in the diff is a copy.');
|
||||
|
@ -103,7 +103,7 @@ class ConfigDiffTest extends KernelTestBase {
|
|||
$test_entity->set('id', $new_test_entity_id);
|
||||
$test_entity->save();
|
||||
|
||||
$diff = \Drupal::service('config.manager')->diff($active, $staging, 'config_test.dynamic.' . $new_test_entity_id, $config_name);
|
||||
$diff = \Drupal::service('config.manager')->diff($active, $sync, 'config_test.dynamic.' . $new_test_entity_id, $config_name);
|
||||
$edits = $diff->getEdits();
|
||||
$this->assertEqual($edits[0]->type, 'copy', 'The first item in the diff is a copy.');
|
||||
$this->assertEqual($edits[1]->type, 'change', 'The second item in the diff is a change.');
|
||||
|
@ -119,27 +119,27 @@ class ConfigDiffTest extends KernelTestBase {
|
|||
function testCollectionDiff() {
|
||||
/** @var \Drupal\Core\Config\StorageInterface $active */
|
||||
$active = $this->container->get('config.storage');
|
||||
/** @var \Drupal\Core\Config\StorageInterface $staging */
|
||||
$staging = $this->container->get('config.storage.staging');
|
||||
/** @var \Drupal\Core\Config\StorageInterface $sync */
|
||||
$sync = $this->container->get('config.storage.sync');
|
||||
$active_test_collection = $active->createCollection('test');
|
||||
$staging_test_collection = $staging->createCollection('test');
|
||||
$sync_test_collection = $sync->createCollection('test');
|
||||
|
||||
$config_name = 'config_test.test';
|
||||
$data = array('foo' => 'bar');
|
||||
|
||||
$active->write($config_name, $data);
|
||||
$staging->write($config_name, $data);
|
||||
$sync->write($config_name, $data);
|
||||
$active_test_collection->write($config_name, $data);
|
||||
$staging_test_collection->write($config_name, array('foo' => 'baz'));
|
||||
$sync_test_collection->write($config_name, array('foo' => 'baz'));
|
||||
|
||||
// Test the fields match in the default collection diff.
|
||||
$diff = \Drupal::service('config.manager')->diff($active, $staging, $config_name);
|
||||
$diff = \Drupal::service('config.manager')->diff($active, $sync, $config_name);
|
||||
$edits = $diff->getEdits();
|
||||
$this->assertEqual($edits[0]->type, 'copy', 'The first item in the diff is a copy.');
|
||||
$this->assertEqual(count($edits), 1, 'There is one item in the diff');
|
||||
|
||||
// Test that the differences are detected when diffing the collection.
|
||||
$diff = \Drupal::service('config.manager')->diff($active, $staging, $config_name, NULL, 'test');
|
||||
$diff = \Drupal::service('config.manager')->diff($active, $sync, $config_name, NULL, 'test');
|
||||
$edits = $diff->getEdits();
|
||||
$this->assertEqual($edits[0]->type, 'change', 'The second item in the diff is a copy.');
|
||||
$this->assertEqual($edits[0]->orig, array('foo: bar'));
|
||||
|
|
|
@ -0,0 +1,68 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Definition of Drupal\config\Tests\ConfigEntityListMultilingualTest.
|
||||
*/
|
||||
|
||||
namespace Drupal\config\Tests;
|
||||
|
||||
use Drupal\simpletest\WebTestBase;
|
||||
use Drupal\language\Entity\ConfigurableLanguage;
|
||||
|
||||
/**
|
||||
* Tests the listing of configuration entities in a multilingual scenario.
|
||||
*
|
||||
* @group config
|
||||
*/
|
||||
class ConfigEntityListMultilingualTest extends WebTestBase {
|
||||
|
||||
/**
|
||||
* Modules to enable.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public static $modules = array('config_test', 'language', 'block');
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function setUp() {
|
||||
parent::setUp();
|
||||
// Delete the override config_test entity. It is not required by this test.
|
||||
\Drupal::entityManager()->getStorage('config_test')->load('override')->delete();
|
||||
ConfigurableLanguage::createFromLangcode('hu')->save();
|
||||
|
||||
$this->drupalPlaceBlock('local_actions_block');
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests the listing UI with different language scenarios.
|
||||
*/
|
||||
function testListUI() {
|
||||
// Log in as an administrative user to access the full menu trail.
|
||||
$this->drupalLogin($this->drupalCreateUser(array('access administration pages', 'administer site configuration')));
|
||||
|
||||
// Get the list page.
|
||||
$this->drupalGet('admin/structure/config_test');
|
||||
$this->assertLinkByHref('admin/structure/config_test/manage/dotted.default');
|
||||
|
||||
// Add a new entity using the action link.
|
||||
$this->clickLink('Add test configuration');
|
||||
$edit = array(
|
||||
'label' => 'Antilop',
|
||||
'id' => 'antilop',
|
||||
'langcode' => 'hu',
|
||||
);
|
||||
$this->drupalPostForm(NULL, $edit, t('Save'));
|
||||
// Ensure that operations for editing the Hungarian entity appear in English.
|
||||
$this->assertLinkByHref('admin/structure/config_test/manage/antilop');
|
||||
|
||||
// Get the list page in Hungarian and assert Hungarian admin links
|
||||
// regardless of language of config entities.
|
||||
$this->drupalGet('hu/admin/structure/config_test');
|
||||
$this->assertLinkByHref('hu/admin/structure/config_test/manage/dotted.default');
|
||||
$this->assertLinkByHref('hu/admin/structure/config_test/manage/antilop');
|
||||
}
|
||||
|
||||
}
|
|
@ -11,7 +11,7 @@ use Drupal\simpletest\KernelTestBase;
|
|||
use Drupal\Core\Config\ConfigDuplicateUUIDException;
|
||||
|
||||
/**
|
||||
* Tests staging and importing config entities with IDs and UUIDs that match
|
||||
* Tests sync and importing config entities with IDs and UUIDs that match
|
||||
* existing config.
|
||||
*
|
||||
* @group config
|
||||
|
|
|
@ -187,25 +187,31 @@ class ConfigExportImportUITest extends WebTestBase {
|
|||
->save();
|
||||
$this->drupalGet('admin/config/development/configuration');
|
||||
$this->assertText(t('Warning message'));
|
||||
$this->assertText('The following items in your active configuration have changes since the last import that may be lost on the next import. system.site');
|
||||
// Remove everything from staging. The warning about differences between the
|
||||
$this->assertText('The following items in your active configuration have changes since the last import that may be lost on the next import.');
|
||||
// Ensure the item is displayed as part of a list (to avoid false matches
|
||||
// on the rest of the page) and that the list markup is not escaped.
|
||||
$this->assertRaw('<li>system.site</li>');
|
||||
// Remove everything from sync. The warning about differences between the
|
||||
// active and snapshot should no longer exist.
|
||||
\Drupal::service('config.storage.staging')->deleteAll();
|
||||
\Drupal::service('config.storage.sync')->deleteAll();
|
||||
$this->drupalGet('admin/config/development/configuration');
|
||||
$this->assertNoText(t('Warning message'));
|
||||
$this->assertNoText('The following items in your active configuration have changes since the last import that may be lost on the next import. system.site');
|
||||
$this->assertNoText('The following items in your active configuration have changes since the last import that may be lost on the next import.');
|
||||
$this->assertText(t('There are no configuration changes to import.'));
|
||||
// Write a file to staging. The warning about differences between the
|
||||
// active and snapshot should now exist.
|
||||
/** @var \Drupal\Core\Config\StorageInterface $staging */
|
||||
$staging = $this->container->get('config.storage.staging');
|
||||
// Write a file to sync. The warning about differences between the active
|
||||
// and snapshot should now exist.
|
||||
/** @var \Drupal\Core\Config\StorageInterface $sync */
|
||||
$sync = $this->container->get('config.storage.sync');
|
||||
$data = $this->config('system.site')->get();
|
||||
$data['slogan'] = 'in the face';
|
||||
$this->copyConfig($this->container->get('config.storage'), $staging);
|
||||
$staging->write('system.site', $data);
|
||||
$this->copyConfig($this->container->get('config.storage'), $sync);
|
||||
$sync->write('system.site', $data);
|
||||
$this->drupalGet('admin/config/development/configuration');
|
||||
$this->assertText(t('Warning message'));
|
||||
$this->assertText('The following items in your active configuration have changes since the last import that may be lost on the next import. system.site');
|
||||
$this->assertText('The following items in your active configuration have changes since the last import that may be lost on the next import.');
|
||||
// Ensure the item is displayed as part of a list (to avoid false matches
|
||||
// on the rest of the page) and that the list markup is not escaped.
|
||||
$this->assertRaw('<li>system.site</li>');
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -273,8 +279,8 @@ class ConfigExportImportUITest extends WebTestBase {
|
|||
// Verify that there are configuration differences to import.
|
||||
$this->drupalGet('admin/config/development/configuration');
|
||||
$this->assertNoText(t('There are no configuration changes to import.'));
|
||||
$this->assertText(t('!collection configuration collection', array('!collection' => 'collection.test1')));
|
||||
$this->assertText(t('!collection configuration collection', array('!collection' => 'collection.test2')));
|
||||
$this->assertText(t('@collection configuration collection', array('@collection' => 'collection.test1')));
|
||||
$this->assertText(t('@collection configuration collection', array('@collection' => 'collection.test2')));
|
||||
$this->assertText('config_test.create');
|
||||
$this->assertLinkByHref('admin/config/development/configuration/sync/diff_collection/collection.test1/config_test.create');
|
||||
$this->assertText('config_test.update');
|
||||
|
|
|
@ -82,6 +82,10 @@ class ConfigExportUITest extends WebTestBase {
|
|||
$file_contents = file_get_contents(file_directory_temp() . '/' . 'system.maintenance.yml');
|
||||
$exported = Yaml::decode($file_contents);
|
||||
$this->assertNotIdentical($exported['message'], 'Foo');
|
||||
|
||||
// Check the single export form doesn't have "form-required" elements.
|
||||
$this->drupalGet('admin/config/development/configuration/single/export');
|
||||
$this->assertNoRaw('js-form-required form-required', 'No form required fields are found.');
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -210,7 +210,7 @@ class ConfigFileContentTest extends KernelTestBase {
|
|||
);
|
||||
|
||||
// Encode and write, and reload and decode the configuration data.
|
||||
$filestorage = new FileStorage($this->configDirectories[CONFIG_ACTIVE_DIRECTORY]);
|
||||
$filestorage = new FileStorage($this->configDirectories[CONFIG_SYNC_DIRECTORY]);
|
||||
$filestorage->write($name, $config_data);
|
||||
$config_parsed = $filestorage->read($name);
|
||||
|
||||
|
|
|
@ -70,8 +70,8 @@ class ConfigImportAllTest extends ModuleTestBase {
|
|||
$this->assertModuleTablesExist($module);
|
||||
}
|
||||
|
||||
// Export active config to staging
|
||||
$this->copyConfig($this->container->get('config.storage'), $this->container->get('config.storage.staging'));
|
||||
// Export active config to sync.
|
||||
$this->copyConfig($this->container->get('config.storage'), $this->container->get('config.storage.sync'));
|
||||
|
||||
system_list_reset();
|
||||
$this->resetAll();
|
||||
|
@ -145,7 +145,7 @@ class ConfigImportAllTest extends ModuleTestBase {
|
|||
|
||||
// Ensure that we have no configuration changes to import.
|
||||
$storage_comparer = new StorageComparer(
|
||||
$this->container->get('config.storage.staging'),
|
||||
$this->container->get('config.storage.sync'),
|
||||
$this->container->get('config.storage'),
|
||||
$this->container->get('config.manager')
|
||||
);
|
||||
|
|
|
@ -42,7 +42,7 @@ class ConfigImportInstallProfileTest extends WebTestBase {
|
|||
|
||||
$this->webUser = $this->drupalCreateUser(array('synchronize configuration'));
|
||||
$this->drupalLogin($this->webUser);
|
||||
$this->copyConfig($this->container->get('config.storage'), $this->container->get('config.storage.staging'));
|
||||
$this->copyConfig($this->container->get('config.storage'), $this->container->get('config.storage.sync'));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -51,13 +51,13 @@ class ConfigImportInstallProfileTest extends WebTestBase {
|
|||
* @see \Drupal\Core\EventSubscriber\ConfigImportSubscriber
|
||||
*/
|
||||
public function testInstallProfileValidation() {
|
||||
$staging = $this->container->get('config.storage.staging');
|
||||
$this->copyConfig($this->container->get('config.storage'), $staging);
|
||||
$core = $staging->read('core.extension');
|
||||
$sync = $this->container->get('config.storage.sync');
|
||||
$this->copyConfig($this->container->get('config.storage'), $sync);
|
||||
$core = $sync->read('core.extension');
|
||||
|
||||
// Ensure install profiles can not be uninstalled.
|
||||
unset($core['module']['testing_config_import']);
|
||||
$staging->write('core.extension', $core);
|
||||
$sync->write('core.extension', $core);
|
||||
|
||||
$this->drupalPostForm('admin/config/development/configuration', array(), t('Import all'));
|
||||
$this->assertText('The configuration cannot be imported because it failed validation for the following reasons:');
|
||||
|
@ -68,11 +68,11 @@ class ConfigImportInstallProfileTest extends WebTestBase {
|
|||
unset($core['module']['syslog']);
|
||||
unset($core['theme']['stark']);
|
||||
$core['theme']['classy'] = 0;
|
||||
$staging->write('core.extension', $core);
|
||||
$staging->deleteAll('syslog.');
|
||||
$theme = $staging->read('system.theme');
|
||||
$sync->write('core.extension', $core);
|
||||
$sync->deleteAll('syslog.');
|
||||
$theme = $sync->read('system.theme');
|
||||
$theme['default'] = 'classy';
|
||||
$staging->write('system.theme', $theme);
|
||||
$sync->write('system.theme', $theme);
|
||||
$this->drupalPostForm('admin/config/development/configuration', array(), t('Import all'));
|
||||
$this->assertText('The configuration was imported successfully.');
|
||||
$this->rebuildContainer();
|
||||
|
|
|
@ -32,7 +32,7 @@ class ConfigImportRecreateTest extends KernelTestBase {
|
|||
*
|
||||
* @var array
|
||||
*/
|
||||
public static $modules = array('system', 'field', 'text', 'user', 'node', 'entity_reference');
|
||||
public static $modules = ['system', 'field', 'text', 'user', 'node'];
|
||||
|
||||
protected function setUp() {
|
||||
parent::setUp();
|
||||
|
@ -40,11 +40,11 @@ class ConfigImportRecreateTest extends KernelTestBase {
|
|||
$this->installEntitySchema('node');
|
||||
$this->installConfig(array('field', 'node'));
|
||||
|
||||
$this->copyConfig($this->container->get('config.storage'), $this->container->get('config.storage.staging'));
|
||||
$this->copyConfig($this->container->get('config.storage'), $this->container->get('config.storage.sync'));
|
||||
|
||||
// Set up the ConfigImporter object for testing.
|
||||
$storage_comparer = new StorageComparer(
|
||||
$this->container->get('config.storage.staging'),
|
||||
$this->container->get('config.storage.sync'),
|
||||
$this->container->get('config.storage'),
|
||||
$this->container->get('config.manager')
|
||||
);
|
||||
|
@ -71,11 +71,11 @@ class ConfigImportRecreateTest extends KernelTestBase {
|
|||
node_add_body_field($content_type);
|
||||
/** @var \Drupal\Core\Config\StorageInterface $active */
|
||||
$active = $this->container->get('config.storage');
|
||||
/** @var \Drupal\Core\Config\StorageInterface $staging */
|
||||
$staging = $this->container->get('config.storage.staging');
|
||||
/** @var \Drupal\Core\Config\StorageInterface $sync */
|
||||
$sync = $this->container->get('config.storage.sync');
|
||||
|
||||
$config_name = $content_type->getEntityType()->getConfigPrefix() . '.' . $content_type->id();
|
||||
$this->copyConfig($active, $staging);
|
||||
$this->copyConfig($active, $sync);
|
||||
|
||||
// Delete the content type. This will also delete a field storage, a field,
|
||||
// an entity view display and an entity form display.
|
||||
|
|
|
@ -34,7 +34,7 @@ class ConfigImportRenameValidationTest extends KernelTestBase {
|
|||
*
|
||||
* @var array
|
||||
*/
|
||||
public static $modules = array('system', 'user', 'node', 'field', 'text', 'config_test', 'entity_reference');
|
||||
public static $modules = ['system', 'user', 'node', 'field', 'text', 'config_test'];
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
|
@ -48,7 +48,7 @@ class ConfigImportRenameValidationTest extends KernelTestBase {
|
|||
|
||||
// Set up the ConfigImporter object for testing.
|
||||
$storage_comparer = new StorageComparer(
|
||||
$this->container->get('config.storage.staging'),
|
||||
$this->container->get('config.storage.sync'),
|
||||
$this->container->get('config.storage'),
|
||||
$this->container->get('config.manager')
|
||||
);
|
||||
|
@ -80,8 +80,8 @@ class ConfigImportRenameValidationTest extends KernelTestBase {
|
|||
|
||||
// Stage the test entity and then delete it from the active storage.
|
||||
$active = $this->container->get('config.storage');
|
||||
$staging = $this->container->get('config.storage.staging');
|
||||
$this->copyConfig($active, $staging);
|
||||
$sync = $this->container->get('config.storage.sync');
|
||||
$this->copyConfig($active, $sync);
|
||||
$test_entity->delete();
|
||||
|
||||
// Create a content type with a matching UUID in the active storage.
|
||||
|
@ -110,9 +110,9 @@ class ConfigImportRenameValidationTest extends KernelTestBase {
|
|||
catch (ConfigImporterException $e) {
|
||||
$this->pass('Expected ConfigImporterException thrown when a renamed configuration entity does not match the existing entity type.');
|
||||
$expected = array(
|
||||
SafeMarkup::format('Entity type mismatch on rename. !old_type not equal to !new_type for existing configuration !old_name and staged configuration !new_name.', array('old_type' => 'node_type', 'new_type' => 'config_test', 'old_name' => 'node.type.' . $content_type->id(), 'new_name' => 'config_test.dynamic.' . $test_entity_id))
|
||||
SafeMarkup::format('Entity type mismatch on rename. @old_type not equal to @new_type for existing configuration @old_name and staged configuration @new_name.', array('@old_type' => 'node_type', '@new_type' => 'config_test', '@old_name' => 'node.type.' . $content_type->id(), '@new_name' => 'config_test.dynamic.' . $test_entity_id))
|
||||
);
|
||||
$this->assertIdentical($expected, $this->configImporter->getErrors());
|
||||
$this->assertEqual($expected, $this->configImporter->getErrors());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -127,8 +127,8 @@ class ConfigImportRenameValidationTest extends KernelTestBase {
|
|||
$config->set('uuid', $uuid_value)->save();
|
||||
|
||||
$active = $this->container->get('config.storage');
|
||||
$staging = $this->container->get('config.storage.staging');
|
||||
$this->copyConfig($active, $staging);
|
||||
$sync = $this->container->get('config.storage.sync');
|
||||
$this->copyConfig($active, $sync);
|
||||
$config->delete();
|
||||
|
||||
// Create another simple configuration with the same UUID.
|
||||
|
@ -153,9 +153,9 @@ class ConfigImportRenameValidationTest extends KernelTestBase {
|
|||
catch (ConfigImporterException $e) {
|
||||
$this->pass('Expected ConfigImporterException thrown when simple configuration is renamed.');
|
||||
$expected = array(
|
||||
SafeMarkup::format('Rename operation for simple configuration. Existing configuration !old_name and staged configuration !new_name.', array('old_name' => 'config_test.old', 'new_name' => 'config_test.new'))
|
||||
SafeMarkup::format('Rename operation for simple configuration. Existing configuration @old_name and staged configuration @new_name.', array('@old_name' => 'config_test.old', '@new_name' => 'config_test.new'))
|
||||
);
|
||||
$this->assertIdentical($expected, $this->configImporter->getErrors());
|
||||
$this->assertEqual($expected, $this->configImporter->getErrors());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -38,7 +38,7 @@ class ConfigImportUITest extends WebTestBase {
|
|||
|
||||
$this->webUser = $this->drupalCreateUser(array('synchronize configuration'));
|
||||
$this->drupalLogin($this->webUser);
|
||||
$this->copyConfig($this->container->get('config.storage'), $this->container->get('config.storage.staging'));
|
||||
$this->copyConfig($this->container->get('config.storage'), $this->container->get('config.storage.sync'));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -47,8 +47,8 @@ class ConfigImportUITest extends WebTestBase {
|
|||
function testImport() {
|
||||
$name = 'system.site';
|
||||
$dynamic_name = 'config_test.dynamic.new';
|
||||
/** @var \Drupal\Core\Config\StorageInterface $staging */
|
||||
$staging = $this->container->get('config.storage.staging');
|
||||
/** @var \Drupal\Core\Config\StorageInterface $sync */
|
||||
$sync = $this->container->get('config.storage.sync');
|
||||
|
||||
$this->drupalGet('admin/config/development/configuration');
|
||||
$this->assertText('There are no configuration changes to import.');
|
||||
|
@ -57,7 +57,7 @@ class ConfigImportUITest extends WebTestBase {
|
|||
// Create updated configuration object.
|
||||
$new_site_name = 'Config import test ' . $this->randomString();
|
||||
$this->prepareSiteNameUpdate($new_site_name);
|
||||
$this->assertIdentical($staging->exists($name), TRUE, $name . ' found.');
|
||||
$this->assertIdentical($sync->exists($name), TRUE, $name . ' found.');
|
||||
|
||||
// Create new config entity.
|
||||
$original_dynamic_data = array(
|
||||
|
@ -73,8 +73,8 @@ class ConfigImportUITest extends WebTestBase {
|
|||
'size_value' => '',
|
||||
'protected_property' => '',
|
||||
);
|
||||
$staging->write($dynamic_name, $original_dynamic_data);
|
||||
$this->assertIdentical($staging->exists($dynamic_name), TRUE, $dynamic_name . ' found.');
|
||||
$sync->write($dynamic_name, $original_dynamic_data);
|
||||
$this->assertIdentical($sync->exists($dynamic_name), TRUE, $dynamic_name . ' found.');
|
||||
|
||||
// Enable the Action and Ban modules during import. The Ban
|
||||
// module is used because it creates a table during the install. The Action
|
||||
|
@ -87,7 +87,7 @@ class ConfigImportUITest extends WebTestBase {
|
|||
// Bartik is a subtheme of classy so classy must be enabled.
|
||||
$core_extension['theme']['classy'] = 0;
|
||||
$core_extension['theme']['bartik'] = 0;
|
||||
$staging->write('core.extension', $core_extension);
|
||||
$sync->write('core.extension', $core_extension);
|
||||
|
||||
// Use the install storage so that we can read configuration from modules
|
||||
// and themes that are not installed.
|
||||
|
@ -96,17 +96,17 @@ class ConfigImportUITest extends WebTestBase {
|
|||
// Set the Bartik theme as default.
|
||||
$system_theme = $this->config('system.theme')->get();
|
||||
$system_theme['default'] = 'bartik';
|
||||
$staging->write('system.theme', $system_theme);
|
||||
$sync->write('system.theme', $system_theme);
|
||||
|
||||
// Read the action config from module default config folder.
|
||||
$action_settings = $install_storage->read('action.settings');
|
||||
$action_settings['recursion_limit'] = 50;
|
||||
$staging->write('action.settings', $action_settings);
|
||||
$sync->write('action.settings', $action_settings);
|
||||
|
||||
// Uninstall the Options and Text modules to ensure that dependencies are
|
||||
// handled correctly. Options depends on Text so Text should be installed
|
||||
// first. Since they were enabled during the test setup the core.extension
|
||||
// file in staging will already contain them.
|
||||
// file in sync will already contain them.
|
||||
\Drupal::service('module_installer')->uninstall(array('text', 'options'));
|
||||
|
||||
// Set the state system to record installations and uninstallations.
|
||||
|
@ -175,14 +175,14 @@ class ConfigImportUITest extends WebTestBase {
|
|||
unset($core_extension['module']['options']);
|
||||
unset($core_extension['module']['text']);
|
||||
unset($core_extension['theme']['bartik']);
|
||||
$staging->write('core.extension', $core_extension);
|
||||
$staging->delete('action.settings');
|
||||
$staging->delete('text.settings');
|
||||
$sync->write('core.extension', $core_extension);
|
||||
$sync->delete('action.settings');
|
||||
$sync->delete('text.settings');
|
||||
|
||||
$system_theme = $this->config('system.theme')->get();
|
||||
$system_theme['default'] = 'stark';
|
||||
$system_theme['admin'] = 'stark';
|
||||
$staging->write('system.theme', $system_theme);
|
||||
$sync->write('system.theme', $system_theme);
|
||||
|
||||
// Set the state system to record installations and uninstallations.
|
||||
\Drupal::state()->set('ConfigImportUITest.core.extension.modules_installed', array());
|
||||
|
@ -254,12 +254,12 @@ class ConfigImportUITest extends WebTestBase {
|
|||
* Tests verification of site UUID before importing configuration.
|
||||
*/
|
||||
function testImportSiteUuidValidation() {
|
||||
$staging = \Drupal::service('config.storage.staging');
|
||||
$sync = \Drupal::service('config.storage.sync');
|
||||
// Create updated configuration object.
|
||||
$config_data = $this->config('system.site')->get();
|
||||
// Generate a new site UUID.
|
||||
$config_data['uuid'] = \Drupal::service('uuid')->generate();
|
||||
$staging->write('system.site', $config_data);
|
||||
$sync->write('system.site', $config_data);
|
||||
|
||||
// Verify that there are configuration differences to import.
|
||||
$this->drupalGet('admin/config/development/configuration');
|
||||
|
@ -268,10 +268,10 @@ class ConfigImportUITest extends WebTestBase {
|
|||
}
|
||||
|
||||
/**
|
||||
* Tests the screen that shows differences between active and staging.
|
||||
* Tests the screen that shows differences between active and sync.
|
||||
*/
|
||||
function testImportDiff() {
|
||||
$staging = $this->container->get('config.storage.staging');
|
||||
$sync = $this->container->get('config.storage.sync');
|
||||
$config_name = 'config_test.system';
|
||||
$change_key = 'foo';
|
||||
$remove_key = '404';
|
||||
|
@ -286,12 +286,12 @@ class ConfigImportUITest extends WebTestBase {
|
|||
// Update active storage to have html in config data.
|
||||
$this->config($config_name)->setData($original_data)->save();
|
||||
|
||||
// Change a configuration value in staging.
|
||||
$staging_data = $original_data;
|
||||
$staging_data[$change_key] = $change_data;
|
||||
$staging_data[$add_key] = $add_data;
|
||||
unset($staging_data[$remove_key]);
|
||||
$staging->write($config_name, $staging_data);
|
||||
// Change a configuration value in sync.
|
||||
$sync_data = $original_data;
|
||||
$sync_data[$change_key] = $change_data;
|
||||
$sync_data[$add_key] = $add_data;
|
||||
unset($sync_data[$remove_key]);
|
||||
$sync->write($config_name, $sync_data);
|
||||
|
||||
// Load the diff UI and verify that the diff reflects the change.
|
||||
$this->drupalGet('admin/config/development/configuration/sync/diff/' . $config_name);
|
||||
|
@ -312,9 +312,9 @@ class ConfigImportUITest extends WebTestBase {
|
|||
$this->assertText(Html::escape("404: '<em>herp</em>'"));
|
||||
|
||||
// Reset data back to original, and remove a key
|
||||
$staging_data = $original_data;
|
||||
unset($staging_data[$remove_key]);
|
||||
$staging->write($config_name, $staging_data);
|
||||
$sync_data = $original_data;
|
||||
unset($sync_data[$remove_key]);
|
||||
$sync->write($config_name, $sync_data);
|
||||
|
||||
// Load the diff UI and verify that the diff reflects a removed key.
|
||||
$this->drupalGet('admin/config/development/configuration/sync/diff/' . $config_name);
|
||||
|
@ -325,9 +325,9 @@ class ConfigImportUITest extends WebTestBase {
|
|||
$this->assertText(Html::escape("404: '<em>herp</em>'"));
|
||||
|
||||
// Reset data back to original and add a key
|
||||
$staging_data = $original_data;
|
||||
$staging_data[$add_key] = $add_data;
|
||||
$staging->write($config_name, $staging_data);
|
||||
$sync_data = $original_data;
|
||||
$sync_data[$add_key] = $add_data;
|
||||
$sync->write($config_name, $sync_data);
|
||||
|
||||
// Load the diff UI and verify that the diff reflects an added key.
|
||||
$this->drupalGet('admin/config/development/configuration/sync/diff/' . $config_name);
|
||||
|
@ -364,11 +364,11 @@ class ConfigImportUITest extends WebTestBase {
|
|||
}
|
||||
|
||||
public function testConfigUninstallConfigException() {
|
||||
$staging = $this->container->get('config.storage.staging');
|
||||
$sync = $this->container->get('config.storage.sync');
|
||||
|
||||
$core_extension = $this->config('core.extension')->get();
|
||||
unset($core_extension['module']['config']);
|
||||
$staging->write('core.extension', $core_extension);
|
||||
$sync->write('core.extension', $core_extension);
|
||||
|
||||
$this->drupalGet('admin/config/development/configuration');
|
||||
$this->assertText('core.extension');
|
||||
|
@ -379,11 +379,11 @@ class ConfigImportUITest extends WebTestBase {
|
|||
}
|
||||
|
||||
function prepareSiteNameUpdate($new_site_name) {
|
||||
$staging = $this->container->get('config.storage.staging');
|
||||
$sync = $this->container->get('config.storage.sync');
|
||||
// Create updated configuration object.
|
||||
$config_data = $this->config('system.site')->get();
|
||||
$config_data['name'] = $new_site_name;
|
||||
$staging->write('system.site', $config_data);
|
||||
$sync->write('system.site', $config_data);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -392,7 +392,7 @@ class ConfigImportUITest extends WebTestBase {
|
|||
function testImportErrorLog() {
|
||||
$name_primary = 'config_test.dynamic.primary';
|
||||
$name_secondary = 'config_test.dynamic.secondary';
|
||||
$staging = $this->container->get('config.storage.staging');
|
||||
$sync = $this->container->get('config.storage.sync');
|
||||
$uuid = $this->container->get('uuid');
|
||||
|
||||
$values_primary = array(
|
||||
|
@ -408,7 +408,7 @@ class ConfigImportUITest extends WebTestBase {
|
|||
'size_value' => NULL,
|
||||
'protected_property' => NULL,
|
||||
);
|
||||
$staging->write($name_primary, $values_primary);
|
||||
$sync->write($name_primary, $values_primary);
|
||||
$values_secondary = array(
|
||||
'uuid' => $uuid->generate(),
|
||||
'langcode' => 'en',
|
||||
|
@ -425,7 +425,7 @@ class ConfigImportUITest extends WebTestBase {
|
|||
'size_value' => NULL,
|
||||
'protected_property' => NULL,
|
||||
);
|
||||
$staging->write($name_secondary, $values_secondary);
|
||||
$sync->write($name_secondary, $values_secondary);
|
||||
// Verify that there are configuration differences to import.
|
||||
$this->drupalGet('admin/config/development/configuration');
|
||||
$this->assertNoText(t('There are no configuration changes to import.'));
|
||||
|
@ -445,7 +445,7 @@ class ConfigImportUITest extends WebTestBase {
|
|||
*/
|
||||
public function testEntityBundleDelete() {
|
||||
\Drupal::service('module_installer')->install(array('node'));
|
||||
$this->copyConfig($this->container->get('config.storage'), $this->container->get('config.storage.staging'));
|
||||
$this->copyConfig($this->container->get('config.storage'), $this->container->get('config.storage.sync'));
|
||||
|
||||
$node_type = $this->drupalCreateContentType();
|
||||
$node = $this->drupalCreateNode(array('type' => $node_type->id()));
|
||||
|
@ -492,9 +492,9 @@ class ConfigImportUITest extends WebTestBase {
|
|||
\Drupal::service('theme_handler')->install(['bartik']);
|
||||
$this->rebuildContainer();
|
||||
|
||||
$staging = $this->container->get('config.storage.staging');
|
||||
$this->copyConfig($this->container->get('config.storage'), $staging);
|
||||
$core = $staging->read('core.extension');
|
||||
$sync = $this->container->get('config.storage.sync');
|
||||
$this->copyConfig($this->container->get('config.storage'), $sync);
|
||||
$core = $sync->read('core.extension');
|
||||
// Node depends on text.
|
||||
unset($core['module']['text']);
|
||||
$module_data = system_rebuild_module_data();
|
||||
|
@ -507,7 +507,7 @@ class ConfigImportUITest extends WebTestBase {
|
|||
$core['module']['does_not_exist'] = 0;
|
||||
// This theme does not exist.
|
||||
$core['theme']['does_not_exist'] = 0;
|
||||
$staging->write('core.extension', $core);
|
||||
$sync->write('core.extension', $core);
|
||||
|
||||
$this->drupalPostForm('admin/config/development/configuration', array(), t('Import all'));
|
||||
$this->assertText('The configuration cannot be imported because it failed validation for the following reasons:');
|
||||
|
|
|
@ -45,11 +45,11 @@ class ConfigImporterMissingContentTest extends KernelTestBase {
|
|||
// so it has to be cleared out manually.
|
||||
unset($GLOBALS['hook_config_test']);
|
||||
|
||||
$this->copyConfig($this->container->get('config.storage'), $this->container->get('config.storage.staging'));
|
||||
$this->copyConfig($this->container->get('config.storage'), $this->container->get('config.storage.sync'));
|
||||
|
||||
// Set up the ConfigImporter object for testing.
|
||||
$storage_comparer = new StorageComparer(
|
||||
$this->container->get('config.storage.staging'),
|
||||
$this->container->get('config.storage.sync'),
|
||||
$this->container->get('config.storage'),
|
||||
$this->container->get('config.manager')
|
||||
);
|
||||
|
@ -75,10 +75,10 @@ class ConfigImporterMissingContentTest extends KernelTestBase {
|
|||
function testMissingContent() {
|
||||
\Drupal::state()->set('config_import_test.config_import_missing_content', TRUE);
|
||||
|
||||
// Update a configuration entity in the staging directory to have a
|
||||
// dependency on two content entities that do not exist.
|
||||
// Update a configuration entity in the sync directory to have a dependency
|
||||
// on two content entities that do not exist.
|
||||
$storage = $this->container->get('config.storage');
|
||||
$staging = $this->container->get('config.storage.staging');
|
||||
$sync = $this->container->get('config.storage.sync');
|
||||
$entity_one = entity_create('entity_test', array('name' => 'one'));
|
||||
$entity_two = entity_create('entity_test', array('name' => 'two'));
|
||||
$entity_three = entity_create('entity_test', array('name' => 'three'));
|
||||
|
@ -93,7 +93,7 @@ class ConfigImporterMissingContentTest extends KernelTestBase {
|
|||
// Entity three will be resolved by
|
||||
// \Drupal\Core\Config\Importer\FinalMissingContentSubscriber.
|
||||
$original_dynamic_data['dependencies']['content'][] = $entity_three->getConfigDependencyName();
|
||||
$staging->write($dynamic_name, $original_dynamic_data);
|
||||
$sync->write($dynamic_name, $original_dynamic_data);
|
||||
|
||||
// Import.
|
||||
$this->configImporter->reset()->import();
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
|
||||
namespace Drupal\config\Tests;
|
||||
|
||||
use Drupal\Component\Utility\Html;
|
||||
use Drupal\Component\Utility\SafeMarkup;
|
||||
use Drupal\Core\Config\ConfigImporter;
|
||||
use Drupal\Core\Config\ConfigImporterException;
|
||||
|
@ -43,11 +44,11 @@ class ConfigImporterTest extends KernelTestBase {
|
|||
// so it has to be cleared out manually.
|
||||
unset($GLOBALS['hook_config_test']);
|
||||
|
||||
$this->copyConfig($this->container->get('config.storage'), $this->container->get('config.storage.staging'));
|
||||
$this->copyConfig($this->container->get('config.storage'), $this->container->get('config.storage.sync'));
|
||||
|
||||
// Set up the ConfigImporter object for testing.
|
||||
$storage_comparer = new StorageComparer(
|
||||
$this->container->get('config.storage.staging'),
|
||||
$this->container->get('config.storage.sync'),
|
||||
$this->container->get('config.storage'),
|
||||
$this->container->get('config.manager')
|
||||
);
|
||||
|
@ -79,12 +80,12 @@ class ConfigImporterTest extends KernelTestBase {
|
|||
}
|
||||
|
||||
/**
|
||||
* Tests that trying to import from an empty staging configuration directory
|
||||
* Tests that trying to import from an empty sync configuration directory
|
||||
* fails.
|
||||
*/
|
||||
function testEmptyImportFails() {
|
||||
try {
|
||||
$this->container->get('config.storage.staging')->deleteAll();
|
||||
$this->container->get('config.storage.sync')->deleteAll();
|
||||
$this->configImporter->reset()->import();
|
||||
$this->fail('ConfigImporterException thrown, successfully stopping an empty import.');
|
||||
}
|
||||
|
@ -97,12 +98,12 @@ class ConfigImporterTest extends KernelTestBase {
|
|||
* Tests verification of site UUID before importing configuration.
|
||||
*/
|
||||
function testSiteUuidValidate() {
|
||||
$staging = \Drupal::service('config.storage.staging');
|
||||
$sync = \Drupal::service('config.storage.sync');
|
||||
// Create updated configuration object.
|
||||
$config_data = $this->config('system.site')->get();
|
||||
// Generate a new site UUID.
|
||||
$config_data['uuid'] = \Drupal::service('uuid')->generate();
|
||||
$staging->write('system.site', $config_data);
|
||||
$sync->write('system.site', $config_data);
|
||||
try {
|
||||
$this->configImporter->reset()->import();
|
||||
$this->fail('ConfigImporterException not thrown, invalid import was not stopped due to mis-matching site UUID.');
|
||||
|
@ -121,14 +122,14 @@ class ConfigImporterTest extends KernelTestBase {
|
|||
function testDeleted() {
|
||||
$dynamic_name = 'config_test.dynamic.dotted.default';
|
||||
$storage = $this->container->get('config.storage');
|
||||
$staging = $this->container->get('config.storage.staging');
|
||||
$sync = $this->container->get('config.storage.sync');
|
||||
|
||||
// Verify the default configuration values exist.
|
||||
$config = $this->config($dynamic_name);
|
||||
$this->assertIdentical($config->get('id'), 'dotted.default');
|
||||
|
||||
// Delete the file from the staging directory.
|
||||
$staging->delete($dynamic_name);
|
||||
// Delete the file from the sync directory.
|
||||
$sync->delete($dynamic_name);
|
||||
|
||||
// Import.
|
||||
$this->configImporter->reset()->import();
|
||||
|
@ -158,7 +159,7 @@ class ConfigImporterTest extends KernelTestBase {
|
|||
function testNew() {
|
||||
$dynamic_name = 'config_test.dynamic.new';
|
||||
$storage = $this->container->get('config.storage');
|
||||
$staging = $this->container->get('config.storage.staging');
|
||||
$sync = $this->container->get('config.storage.sync');
|
||||
|
||||
// Verify the configuration to create does not exist yet.
|
||||
$this->assertIdentical($storage->exists($dynamic_name), FALSE, $dynamic_name . ' not found.');
|
||||
|
@ -177,9 +178,9 @@ class ConfigImporterTest extends KernelTestBase {
|
|||
'size_value' => '',
|
||||
'protected_property' => '',
|
||||
);
|
||||
$staging->write($dynamic_name, $original_dynamic_data);
|
||||
$sync->write($dynamic_name, $original_dynamic_data);
|
||||
|
||||
$this->assertIdentical($staging->exists($dynamic_name), TRUE, $dynamic_name . ' found.');
|
||||
$this->assertIdentical($sync->exists($dynamic_name), TRUE, $dynamic_name . ' found.');
|
||||
|
||||
// Import.
|
||||
$this->configImporter->reset()->import();
|
||||
|
@ -212,7 +213,7 @@ class ConfigImporterTest extends KernelTestBase {
|
|||
function testSecondaryWritePrimaryFirst() {
|
||||
$name_primary = 'config_test.dynamic.primary';
|
||||
$name_secondary = 'config_test.dynamic.secondary';
|
||||
$staging = $this->container->get('config.storage.staging');
|
||||
$sync = $this->container->get('config.storage.sync');
|
||||
$uuid = $this->container->get('uuid');
|
||||
|
||||
$values_primary = array(
|
||||
|
@ -221,7 +222,7 @@ class ConfigImporterTest extends KernelTestBase {
|
|||
'weight' => 0,
|
||||
'uuid' => $uuid->generate(),
|
||||
);
|
||||
$staging->write($name_primary, $values_primary);
|
||||
$sync->write($name_primary, $values_primary);
|
||||
$values_secondary = array(
|
||||
'id' => 'secondary',
|
||||
'label' => 'Secondary Sync',
|
||||
|
@ -232,7 +233,7 @@ class ConfigImporterTest extends KernelTestBase {
|
|||
'config' => array($name_primary),
|
||||
)
|
||||
);
|
||||
$staging->write($name_secondary, $values_secondary);
|
||||
$sync->write($name_secondary, $values_secondary);
|
||||
|
||||
// Import.
|
||||
$this->configImporter->reset()->import();
|
||||
|
@ -258,7 +259,7 @@ class ConfigImporterTest extends KernelTestBase {
|
|||
function testSecondaryWriteSecondaryFirst() {
|
||||
$name_primary = 'config_test.dynamic.primary';
|
||||
$name_secondary = 'config_test.dynamic.secondary';
|
||||
$staging = $this->container->get('config.storage.staging');
|
||||
$sync = $this->container->get('config.storage.sync');
|
||||
$uuid = $this->container->get('uuid');
|
||||
|
||||
$values_primary = array(
|
||||
|
@ -271,14 +272,14 @@ class ConfigImporterTest extends KernelTestBase {
|
|||
'config' => array($name_secondary),
|
||||
)
|
||||
);
|
||||
$staging->write($name_primary, $values_primary);
|
||||
$sync->write($name_primary, $values_primary);
|
||||
$values_secondary = array(
|
||||
'id' => 'secondary',
|
||||
'label' => 'Secondary Sync',
|
||||
'weight' => 0,
|
||||
'uuid' => $uuid->generate(),
|
||||
);
|
||||
$staging->write($name_secondary, $values_secondary);
|
||||
$sync->write($name_secondary, $values_secondary);
|
||||
|
||||
// Import.
|
||||
$this->configImporter->reset()->import();
|
||||
|
@ -295,8 +296,7 @@ class ConfigImporterTest extends KernelTestBase {
|
|||
|
||||
$logs = $this->configImporter->getErrors();
|
||||
$this->assertEqual(count($logs), 1);
|
||||
$message = SafeMarkup::format("'config_test' entity with ID '@name' already exists", array('@name' => 'secondary'));
|
||||
$this->assertEqual($logs[0], SafeMarkup::format('Unexpected error during import with operation @op for @name: !message.', array('@op' => 'create', '@name' => $name_primary, '!message' => $message)));
|
||||
$this->assertEqual($logs[0], Html::escape("Unexpected error during import with operation create for $name_primary: 'config_test' entity with ID 'secondary' already exists."));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -307,7 +307,7 @@ class ConfigImporterTest extends KernelTestBase {
|
|||
$name_deletee = 'config_test.dynamic.deletee';
|
||||
$name_other = 'config_test.dynamic.other';
|
||||
$storage = $this->container->get('config.storage');
|
||||
$staging = $this->container->get('config.storage.staging');
|
||||
$sync = $this->container->get('config.storage.sync');
|
||||
$uuid = $this->container->get('uuid');
|
||||
|
||||
$values_deleter = array(
|
||||
|
@ -318,7 +318,7 @@ class ConfigImporterTest extends KernelTestBase {
|
|||
);
|
||||
$storage->write($name_deleter, $values_deleter);
|
||||
$values_deleter['label'] = 'Updated Deleter';
|
||||
$staging->write($name_deleter, $values_deleter);
|
||||
$sync->write($name_deleter, $values_deleter);
|
||||
$values_deletee = array(
|
||||
'id' => 'deletee',
|
||||
'label' => 'Deletee',
|
||||
|
@ -331,7 +331,7 @@ class ConfigImporterTest extends KernelTestBase {
|
|||
);
|
||||
$storage->write($name_deletee, $values_deletee);
|
||||
$values_deletee['label'] = 'Updated Deletee';
|
||||
$staging->write($name_deletee, $values_deletee);
|
||||
$sync->write($name_deletee, $values_deletee);
|
||||
|
||||
// Ensure that import will continue after the error.
|
||||
$values_other = array(
|
||||
|
@ -347,7 +347,7 @@ class ConfigImporterTest extends KernelTestBase {
|
|||
);
|
||||
$storage->write($name_other, $values_other);
|
||||
$values_other['label'] = 'Updated other';
|
||||
$staging->write($name_other, $values_other);
|
||||
$sync->write($name_other, $values_other);
|
||||
|
||||
// Check update changelist order.
|
||||
$updates = $this->configImporter->reset()->getStorageComparer()->getChangelist('update');
|
||||
|
@ -392,7 +392,7 @@ class ConfigImporterTest extends KernelTestBase {
|
|||
$name_deleter = 'config_test.dynamic.deleter';
|
||||
$name_deletee = 'config_test.dynamic.deletee';
|
||||
$storage = $this->container->get('config.storage');
|
||||
$staging = $this->container->get('config.storage.staging');
|
||||
$sync = $this->container->get('config.storage.sync');
|
||||
$uuid = $this->container->get('uuid');
|
||||
|
||||
$values_deleter = array(
|
||||
|
@ -407,7 +407,7 @@ class ConfigImporterTest extends KernelTestBase {
|
|||
);
|
||||
$storage->write($name_deleter, $values_deleter);
|
||||
$values_deleter['label'] = 'Updated Deleter';
|
||||
$staging->write($name_deleter, $values_deleter);
|
||||
$sync->write($name_deleter, $values_deleter);
|
||||
$values_deletee = array(
|
||||
'id' => 'deletee',
|
||||
'label' => 'Deletee',
|
||||
|
@ -416,7 +416,7 @@ class ConfigImporterTest extends KernelTestBase {
|
|||
);
|
||||
$storage->write($name_deletee, $values_deletee);
|
||||
$values_deletee['label'] = 'Updated Deletee';
|
||||
$staging->write($name_deletee, $values_deletee);
|
||||
$sync->write($name_deletee, $values_deletee);
|
||||
|
||||
// Import.
|
||||
$this->configImporter->reset()->import();
|
||||
|
@ -480,21 +480,21 @@ class ConfigImporterTest extends KernelTestBase {
|
|||
$name = 'config_test.system';
|
||||
$dynamic_name = 'config_test.dynamic.dotted.default';
|
||||
$storage = $this->container->get('config.storage');
|
||||
$staging = $this->container->get('config.storage.staging');
|
||||
$sync = $this->container->get('config.storage.sync');
|
||||
|
||||
// Verify that the configuration objects to import exist.
|
||||
$this->assertIdentical($storage->exists($name), TRUE, $name . ' found.');
|
||||
$this->assertIdentical($storage->exists($dynamic_name), TRUE, $dynamic_name . ' found.');
|
||||
|
||||
// Replace the file content of the existing configuration objects in the
|
||||
// staging directory.
|
||||
// sync directory.
|
||||
$original_name_data = array(
|
||||
'foo' => 'beer',
|
||||
);
|
||||
$staging->write($name, $original_name_data);
|
||||
$sync->write($name, $original_name_data);
|
||||
$original_dynamic_data = $storage->read($dynamic_name);
|
||||
$original_dynamic_data['label'] = 'Updated';
|
||||
$staging->write($dynamic_name, $original_dynamic_data);
|
||||
$sync->write($dynamic_name, $original_dynamic_data);
|
||||
|
||||
// Verify the active configuration still returns the default values.
|
||||
$config = $this->config($name);
|
||||
|
@ -513,8 +513,8 @@ class ConfigImporterTest extends KernelTestBase {
|
|||
$this->assertIdentical($config->get('label'), 'Updated');
|
||||
|
||||
// Verify that the original file content is still the same.
|
||||
$this->assertIdentical($staging->read($name), $original_name_data);
|
||||
$this->assertIdentical($staging->read($dynamic_name), $original_dynamic_data);
|
||||
$this->assertIdentical($sync->read($name), $original_name_data);
|
||||
$this->assertIdentical($sync->read($dynamic_name), $original_dynamic_data);
|
||||
|
||||
// Verify that appropriate module API hooks have been invoked.
|
||||
$this->assertTrue(isset($GLOBALS['hook_config_test']['load']));
|
||||
|
@ -549,29 +549,29 @@ class ConfigImporterTest extends KernelTestBase {
|
|||
*/
|
||||
public function testUnmetDependency() {
|
||||
$storage = $this->container->get('config.storage');
|
||||
$staging = $this->container->get('config.storage.staging');
|
||||
$sync = $this->container->get('config.storage.sync');
|
||||
|
||||
// Test an unknown configuration owner.
|
||||
$staging->write('unknown.config', ['test' => 'test']);
|
||||
$sync->write('unknown.config', ['test' => 'test']);
|
||||
|
||||
// Make a config entity have unmet dependencies.
|
||||
$config_entity_data = $staging->read('config_test.dynamic.dotted.default');
|
||||
$config_entity_data = $sync->read('config_test.dynamic.dotted.default');
|
||||
$config_entity_data['dependencies'] = ['module' => ['unknown']];
|
||||
$staging->write('config_test.dynamic.dotted.module', $config_entity_data);
|
||||
$sync->write('config_test.dynamic.dotted.module', $config_entity_data);
|
||||
$config_entity_data['dependencies'] = ['theme' => ['unknown']];
|
||||
$staging->write('config_test.dynamic.dotted.theme', $config_entity_data);
|
||||
$sync->write('config_test.dynamic.dotted.theme', $config_entity_data);
|
||||
$config_entity_data['dependencies'] = ['config' => ['unknown']];
|
||||
$staging->write('config_test.dynamic.dotted.config', $config_entity_data);
|
||||
$sync->write('config_test.dynamic.dotted.config', $config_entity_data);
|
||||
|
||||
// Make an active config depend on something that is missing in staging.
|
||||
// Make an active config depend on something that is missing in sync.
|
||||
// The whole configuration needs to be consistent, not only the updated one.
|
||||
$config_entity_data['dependencies'] = [];
|
||||
$storage->write('config_test.dynamic.dotted.deleted', $config_entity_data);
|
||||
$config_entity_data['dependencies'] = ['config' => ['config_test.dynamic.dotted.deleted']];
|
||||
$storage->write('config_test.dynamic.dotted.existing', $config_entity_data);
|
||||
$staging->write('config_test.dynamic.dotted.existing', $config_entity_data);
|
||||
$sync->write('config_test.dynamic.dotted.existing', $config_entity_data);
|
||||
|
||||
$extensions = $staging->read('core.extension');
|
||||
$extensions = $sync->read('core.extension');
|
||||
// Add a module and a theme that do not exist.
|
||||
$extensions['module']['unknown_module'] = 0;
|
||||
$extensions['theme']['unknown_theme'] = 0;
|
||||
|
@ -579,7 +579,7 @@ class ConfigImporterTest extends KernelTestBase {
|
|||
$extensions['module']['book'] = 0;
|
||||
$extensions['theme']['bartik'] = 0;
|
||||
|
||||
$staging->write('core.extension', $extensions);
|
||||
$sync->write('core.extension', $extensions);
|
||||
try {
|
||||
$this->configImporter->reset()->import();
|
||||
$this->fail('ConfigImporterException not thrown; an invalid import was not stopped due to missing dependencies.');
|
||||
|
@ -589,7 +589,7 @@ class ConfigImporterTest extends KernelTestBase {
|
|||
$error_log = $this->configImporter->getErrors();
|
||||
$expected = [
|
||||
'Unable to install the <em class="placeholder">unknown_module</em> module since it does not exist.',
|
||||
'Unable to install the <em class="placeholder">Book</em> module since it requires the <em class="placeholder">Node, Text, Field, Filter, User, Entity Reference</em> modules.',
|
||||
'Unable to install the <em class="placeholder">Book</em> module since it requires the <em class="placeholder">Node, Text, Field, Filter, User</em> modules.',
|
||||
'Unable to install the <em class="placeholder">unknown_theme</em> theme since it does not exist.',
|
||||
'Unable to install the <em class="placeholder">Bartik</em> theme since it requires the <em class="placeholder">Classy</em> theme.',
|
||||
'Configuration <em class="placeholder">config_test.dynamic.dotted.config</em> depends on the <em class="placeholder">unknown</em> configuration that will not exist after import.',
|
||||
|
@ -604,13 +604,13 @@ class ConfigImporterTest extends KernelTestBase {
|
|||
}
|
||||
|
||||
// Make a config entity have mulitple unmet dependencies.
|
||||
$config_entity_data = $staging->read('config_test.dynamic.dotted.default');
|
||||
$config_entity_data = $sync->read('config_test.dynamic.dotted.default');
|
||||
$config_entity_data['dependencies'] = ['module' => ['unknown', 'dblog']];
|
||||
$staging->write('config_test.dynamic.dotted.module', $config_entity_data);
|
||||
$sync->write('config_test.dynamic.dotted.module', $config_entity_data);
|
||||
$config_entity_data['dependencies'] = ['theme' => ['unknown', 'seven']];
|
||||
$staging->write('config_test.dynamic.dotted.theme', $config_entity_data);
|
||||
$sync->write('config_test.dynamic.dotted.theme', $config_entity_data);
|
||||
$config_entity_data['dependencies'] = ['config' => ['unknown', 'unknown2']];
|
||||
$staging->write('config_test.dynamic.dotted.config', $config_entity_data);
|
||||
$sync->write('config_test.dynamic.dotted.config', $config_entity_data);
|
||||
try {
|
||||
$this->configImporter->reset()->import();
|
||||
$this->fail('ConfigImporterException not thrown, invalid import was not stopped due to missing dependencies.');
|
||||
|
@ -635,8 +635,8 @@ class ConfigImporterTest extends KernelTestBase {
|
|||
* @see \Drupal\Core\EventSubscriber\ConfigImportSubscriber
|
||||
*/
|
||||
public function testMissingCoreExtension() {
|
||||
$staging = $this->container->get('config.storage.staging');
|
||||
$staging->delete('core.extension');
|
||||
$sync = $this->container->get('config.storage.sync');
|
||||
$sync->delete('core.extension');
|
||||
try {
|
||||
$this->configImporter->reset()->import();
|
||||
$this->fail('ConfigImporterException not thrown, invalid import was not stopped due to missing dependencies.');
|
||||
|
@ -654,13 +654,13 @@ class ConfigImporterTest extends KernelTestBase {
|
|||
* @see \Drupal\Core\EventSubscriber\ConfigImportSubscriber
|
||||
*/
|
||||
public function testInstallProfile() {
|
||||
$staging = $this->container->get('config.storage.staging');
|
||||
$sync = $this->container->get('config.storage.sync');
|
||||
|
||||
$extensions = $staging->read('core.extension');
|
||||
$extensions = $sync->read('core.extension');
|
||||
// Add an install profile.
|
||||
$extensions['module']['standard'] = 0;
|
||||
|
||||
$staging->write('core.extension', $extensions);
|
||||
$sync->write('core.extension', $extensions);
|
||||
try {
|
||||
$this->configImporter->reset()->import();
|
||||
$this->fail('ConfigImporterException not thrown; an invalid import was not stopped due to missing dependencies.');
|
||||
|
@ -673,4 +673,21 @@ class ConfigImporterTest extends KernelTestBase {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests config_get_config_directory().
|
||||
*/
|
||||
public function testConfigGetConfigDirectory() {
|
||||
$directory = config_get_config_directory(CONFIG_SYNC_DIRECTORY);
|
||||
$this->assertEqual($this->configDirectories[CONFIG_SYNC_DIRECTORY], $directory);
|
||||
|
||||
$message = 'Calling config_get_config_directory() with CONFIG_ACTIVE_DIRECTORY results in an exception.';
|
||||
try {
|
||||
config_get_config_directory(CONFIG_ACTIVE_DIRECTORY);
|
||||
$this->fail($message);
|
||||
}
|
||||
catch (\Exception $e) {
|
||||
$this->pass($message);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -37,7 +37,6 @@ class ConfigInstallProfileOverrideTest extends WebTestBase {
|
|||
// The expected configuration from the system module.
|
||||
$expected_original_data = array(
|
||||
'threshold' => array(
|
||||
'autorun' => 0,
|
||||
'requirements_warning' => 172800,
|
||||
'requirements_error' => 1209600,
|
||||
),
|
||||
|
@ -45,7 +44,6 @@ class ConfigInstallProfileOverrideTest extends WebTestBase {
|
|||
// The expected active configuration altered by the install profile.
|
||||
$expected_profile_data = array(
|
||||
'threshold' => array(
|
||||
'autorun' => 0,
|
||||
'requirements_warning' => 259200,
|
||||
'requirements_error' => 1209600,
|
||||
),
|
||||
|
|
|
@ -211,7 +211,11 @@ class ConfigInstallTest extends KernelTestBase {
|
|||
}
|
||||
$this->installModules(['config_other_module_config_test']);
|
||||
$this->installModules(['config_install_dependency_test']);
|
||||
$this->assertTrue(entity_load('config_test', 'other_module_test_with_dependency'), 'The config_test.dynamic.other_module_test_with_dependency configuration has been created during install.');
|
||||
$entity = \Drupal::entityManager()->getStorage('config_test')->load('other_module_test_with_dependency');
|
||||
$this->assertTrue($entity, 'The config_test.dynamic.other_module_test_with_dependency configuration has been created during install.');
|
||||
// Ensure that dependencies can be added during module installation by
|
||||
// hooks.
|
||||
$this->assertIdentical('config_install_dependency_test', $entity->getDependencies()['module'][0]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -23,7 +23,11 @@ class ConfigLanguageOverrideWebTest extends WebTestBase {
|
|||
*
|
||||
* @var array
|
||||
*/
|
||||
public static $modules = array('language', 'system');
|
||||
public static $modules = [
|
||||
'block',
|
||||
'language',
|
||||
'system'
|
||||
];
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
|
@ -54,6 +58,9 @@ class ConfigLanguageOverrideWebTest extends WebTestBase {
|
|||
->set('name', 'XX site name')
|
||||
->save();
|
||||
|
||||
// Place branding block with site name into header region.
|
||||
$this->drupalPlaceBlock('system_branding_block', ['region' => 'header']);
|
||||
|
||||
$this->drupalLogout();
|
||||
|
||||
// The home page in English should not have the override.
|
||||
|
|
|
@ -25,7 +25,7 @@ class ConfigOverrideTest extends KernelTestBase {
|
|||
|
||||
protected function setUp() {
|
||||
parent::setUp();
|
||||
$this->copyConfig($this->container->get('config.storage'), $this->container->get('config.storage.staging'));
|
||||
$this->copyConfig($this->container->get('config.storage'), $this->container->get('config.storage.sync'));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -93,15 +93,15 @@ class ConfigOverrideTest extends KernelTestBase {
|
|||
$this->assertIdentical($config->getOriginal('baz', FALSE), $expected_original_data['baz']);
|
||||
$this->assertIdentical($config->getOriginal('404', FALSE), $expected_original_data['404']);
|
||||
|
||||
// Write file to staging.
|
||||
$staging = $this->container->get('config.storage.staging');
|
||||
// Write file to sync.
|
||||
$sync = $this->container->get('config.storage.sync');
|
||||
$expected_new_data = array(
|
||||
'foo' => 'barbar',
|
||||
'404' => 'herpderp',
|
||||
);
|
||||
$staging->write('config_test.system', $expected_new_data);
|
||||
$sync->write('config_test.system', $expected_new_data);
|
||||
|
||||
// Import changed data from staging to active.
|
||||
// Import changed data from sync to active.
|
||||
$this->configImporter()->import();
|
||||
$data = $active->read('config_test.system');
|
||||
|
||||
|
|
|
@ -22,7 +22,17 @@ class ConfigSingleImportExportTest extends WebTestBase {
|
|||
*
|
||||
* @var array
|
||||
*/
|
||||
public static $modules = array('config', 'config_test');
|
||||
public static $modules = [
|
||||
'block',
|
||||
'config',
|
||||
'config_test'
|
||||
];
|
||||
|
||||
protected function setUp() {
|
||||
parent::setUp();
|
||||
|
||||
$this->drupalPlaceBlock('page_title_block');
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests importing a single configuration file.
|
||||
|
@ -126,6 +136,10 @@ EOD;
|
|||
public function testImportSimpleConfiguration() {
|
||||
$this->drupalLogin($this->drupalCreateUser(array('import configuration')));
|
||||
$config = $this->config('system.site')->set('name', 'Test simple import');
|
||||
|
||||
// Place branding block with site name into header region.
|
||||
$this->drupalPlaceBlock('system_branding_block', ['region' => 'header']);
|
||||
|
||||
$edit = array(
|
||||
'config_type' => 'system.simple',
|
||||
'config_name' => $config->getName(),
|
||||
|
|
|
@ -32,7 +32,7 @@ class ConfigSnapshotTest extends KernelTestBase {
|
|||
// Update the config snapshot. This allows the parent::setUp() to write
|
||||
// configuration files.
|
||||
\Drupal::service('config.manager')->createSnapshot(\Drupal::service('config.storage'), \Drupal::service('config.storage.snapshot'));
|
||||
$this->copyConfig($this->container->get('config.storage'), $this->container->get('config.storage.staging'));
|
||||
$this->copyConfig($this->container->get('config.storage'), $this->container->get('config.storage.sync'));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -40,7 +40,7 @@ class ConfigSnapshotTest extends KernelTestBase {
|
|||
*/
|
||||
function testSnapshot() {
|
||||
$active = $this->container->get('config.storage');
|
||||
$staging = $this->container->get('config.storage.staging');
|
||||
$sync = $this->container->get('config.storage.sync');
|
||||
$snapshot = $this->container->get('config.storage.snapshot');
|
||||
$config_manager = $this->container->get('config.manager');
|
||||
$config_name = 'config_test.system';
|
||||
|
@ -48,7 +48,7 @@ class ConfigSnapshotTest extends KernelTestBase {
|
|||
$new_data = 'foobar';
|
||||
|
||||
$active_snapshot_comparer = new StorageComparer($active, $snapshot, $config_manager);
|
||||
$staging_snapshot_comparer = new StorageComparer($staging, $snapshot, $config_manager);
|
||||
$sync_snapshot_comparer = new StorageComparer($sync, $snapshot, $config_manager);
|
||||
|
||||
// Verify that we have an initial snapshot that matches the active
|
||||
// configuration. This has to be true as no config should be installed.
|
||||
|
@ -66,17 +66,17 @@ class ConfigSnapshotTest extends KernelTestBase {
|
|||
// objects.
|
||||
$this->assertFalse($active_snapshot_comparer->reset()->hasChanges());
|
||||
|
||||
// Change a configuration value in staging.
|
||||
$staging_data = $this->config($config_name)->get();
|
||||
$staging_data[$config_key] = $new_data;
|
||||
$staging->write($config_name, $staging_data);
|
||||
// Change a configuration value in sync.
|
||||
$sync_data = $this->config($config_name)->get();
|
||||
$sync_data[$config_key] = $new_data;
|
||||
$sync->write($config_name, $sync_data);
|
||||
|
||||
// Verify that active and snapshot match, and that staging doesn't match
|
||||
// Verify that active and snapshot match, and that sync doesn't match
|
||||
// active.
|
||||
$this->assertFalse($active_snapshot_comparer->reset()->hasChanges());
|
||||
$this->assertTrue($staging_snapshot_comparer->createChangelist()->hasChanges());
|
||||
$this->assertTrue($sync_snapshot_comparer->createChangelist()->hasChanges());
|
||||
|
||||
// Import changed data from staging to active.
|
||||
// Import changed data from sync to active.
|
||||
$this->configImporter()->import();
|
||||
|
||||
// Verify changed config was properly imported.
|
||||
|
|
|
@ -17,7 +17,7 @@ use Drupal\simpletest\WebTestBase;
|
|||
*/
|
||||
class LanguageNegotiationFormOverrideTest extends WebTestBase {
|
||||
|
||||
public static $modules = array('language', 'locale');
|
||||
public static $modules = array('language', 'locale', 'locale_test');
|
||||
|
||||
/**
|
||||
* Tests that overrides do not affect language-negotiation form values.
|
||||
|
|
|
@ -33,13 +33,13 @@ trait SchemaCheckTestTrait {
|
|||
if ($errors === FALSE) {
|
||||
// @todo Since the use of this trait is under TestBase, it works.
|
||||
// Can be fixed as part of https://www.drupal.org/node/2260053.
|
||||
$this->fail(SafeMarkup::format('No schema for !config_name', array('!config_name' => $config_name)));
|
||||
$this->fail(SafeMarkup::format('No schema for @config_name', array('@config_name' => $config_name)));
|
||||
return;
|
||||
}
|
||||
elseif ($errors === TRUE) {
|
||||
// @todo Since the use of this trait is under TestBase, it works.
|
||||
// Can be fixed as part of https://www.drupal.org/node/2260053.
|
||||
$this->pass(SafeMarkup::format('Schema found for !config_name and values comply with schema.', array('!config_name' => $config_name)));
|
||||
$this->pass(SafeMarkup::format('Schema found for @config_name and values comply with schema.', array('@config_name' => $config_name)));
|
||||
}
|
||||
else {
|
||||
foreach ($errors as $key => $error) {
|
||||
|
|
|
@ -36,7 +36,10 @@ class CachedStorageTest extends ConfigStorageTestBase {
|
|||
|
||||
protected function setUp() {
|
||||
parent::setUp();
|
||||
$this->fileStorage = new FileStorage($this->configDirectories[CONFIG_ACTIVE_DIRECTORY]);
|
||||
// Create a directory.
|
||||
$dir = $this->publicFilesDirectory . '/config';
|
||||
mkdir($dir);
|
||||
$this->fileStorage = new FileStorage($dir);
|
||||
$this->storage = new CachedStorage($this->fileStorage, \Drupal::service('cache.config'));
|
||||
$this->cache = \Drupal::service('cache_factory')->get('config');
|
||||
// ::listAll() verifications require other configuration data to exist.
|
||||
|
|
|
@ -17,13 +17,23 @@ use Drupal\Core\Config\FileStorage;
|
|||
*/
|
||||
class FileStorageTest extends ConfigStorageTestBase {
|
||||
|
||||
/**
|
||||
* A directory to store configuration in.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $directory;
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function setUp() {
|
||||
parent::setUp();
|
||||
$this->storage = new FileStorage($this->configDirectories[CONFIG_ACTIVE_DIRECTORY]);
|
||||
$this->invalidStorage = new FileStorage($this->configDirectories[CONFIG_ACTIVE_DIRECTORY] . '/nonexisting');
|
||||
// Create a directory.
|
||||
$this->directory = $this->publicFilesDirectory . '/config';
|
||||
mkdir($this->directory);
|
||||
$this->storage = new FileStorage($this->directory);
|
||||
$this->invalidStorage = new FileStorage($this->directory . '/nonexisting');
|
||||
|
||||
// FileStorage::listAll() requires other configuration data to exist.
|
||||
$this->storage->write('system.performance', $this->config('system.performance')->get());
|
||||
|
@ -60,7 +70,7 @@ class FileStorageTest extends ConfigStorageTestBase {
|
|||
$this->assertIdentical($config_files, $expected_files, 'Relative path, two config files found.');
|
||||
|
||||
// Initialize FileStorage with absolute file path.
|
||||
$absolute_path = realpath($this->configDirectories[CONFIG_ACTIVE_DIRECTORY]);
|
||||
$absolute_path = realpath($this->directory);
|
||||
$storage_absolute_path = new FileStorage($absolute_path);
|
||||
$config_files = $storage_absolute_path->listAll();
|
||||
$this->assertIdentical($config_files, $expected_files, 'Absolute path, two config files found.');
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Provides hook implementations for testing purposes.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Implements hook_ENTITY_TYPE_create.
|
||||
*/
|
||||
function config_install_dependency_test_config_test_create(\Drupal\Core\Entity\EntityInterface $entity) {
|
||||
// Add an enforced dependency on this module so that we can test if this is
|
||||
// possible during module installation.
|
||||
$entity->setEnforcedDependencies(['module' => ['config_install_dependency_test']]);
|
||||
}
|
|
@ -6,8 +6,6 @@ status: true
|
|||
langcode: en
|
||||
protected_property: Default
|
||||
dependencies:
|
||||
module:
|
||||
- config_install_dependency_test
|
||||
enforced:
|
||||
module:
|
||||
- config_install_dependency_test
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
threshold:
|
||||
autorun: 0
|
||||
requirements_warning: 172800
|
||||
requirements_error: 1209600
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@ class ConfigTestAccessControlHandler extends EntityAccessControlHandler {
|
|||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function checkAccess(EntityInterface $entity, $operation, $langcode, AccountInterface $account) {
|
||||
public function checkAccess(EntityInterface $entity, $operation, AccountInterface $account) {
|
||||
return AccessResult::allowed();
|
||||
}
|
||||
|
||||
|
|
|
@ -10,6 +10,7 @@ namespace Drupal\config_test;
|
|||
use Drupal\Core\Entity\EntityForm;
|
||||
use Drupal\Core\Entity\Query\QueryFactory;
|
||||
use Drupal\Core\Form\FormStateInterface;
|
||||
use Drupal\Core\Language\LanguageInterface;
|
||||
use Symfony\Component\DependencyInjection\ContainerInterface;
|
||||
|
||||
/**
|
||||
|
@ -126,6 +127,13 @@ class ConfigTestForm extends EntityForm {
|
|||
'#access' => !empty($size),
|
||||
);
|
||||
|
||||
$form['langcode'] = array(
|
||||
'#type' => 'language_select',
|
||||
'#title' => t('Language'),
|
||||
'#languages' => LanguageInterface::STATE_ALL,
|
||||
'#default_value' => $entity->language()->getId(),
|
||||
);
|
||||
|
||||
$form['actions'] = array('#type' => 'actions');
|
||||
$form['actions']['submit'] = array(
|
||||
'#type' => 'submit',
|
||||
|
|
|
@ -35,11 +35,11 @@ class ConfigLocalTasksTest extends LocalTaskIntegrationTestBase {
|
|||
*/
|
||||
public function getConfigAdminRoutes() {
|
||||
return array(
|
||||
array('config.sync', array(array('config.sync', 'config.full', 'config.single'))),
|
||||
array('config.export_full', array(array('config.sync', 'config.full', 'config.single'), array('config.export_full', 'config.import_full'))),
|
||||
array('config.import_full', array(array('config.sync', 'config.full', 'config.single'), array('config.export_full', 'config.import_full'))),
|
||||
array('config.export_single', array(array('config.sync', 'config.full', 'config.single'), array('config.export_single', 'config.import_single'))),
|
||||
array('config.import_single', array(array('config.sync', 'config.full', 'config.single'), array('config.export_single', 'config.import_single'))),
|
||||
array('config.sync', array(array('config.sync', 'config.import', 'config.export'))),
|
||||
array('config.import_full', array(array('config.sync', 'config.import', 'config.export'), array('config.import_full', 'config.import_single'))),
|
||||
array('config.import_single', array(array('config.sync', 'config.import', 'config.export'), array('config.import_full', 'config.import_single'))),
|
||||
array('config.export_full', array(array('config.sync', 'config.import', 'config.export'), array('config.export_full', 'config.export_single'))),
|
||||
array('config.export_single', array(array('config.sync', 'config.import', 'config.export'), array('config.export_full', 'config.export_single'))),
|
||||
);
|
||||
}
|
||||
|
||||
|
|
Reference in a new issue