Commit ddfcac8d authored by catch's avatar catch

Issue #3012001 by quietone, rkostov, ellenoise: Duplications within migration process plugin

parent 58abc5cd
......@@ -278,7 +278,7 @@ public function __construct(array $configuration, $plugin_id, $plugin_definition
$this->destinationPluginManager = $destination_plugin_manager;
$this->idMapPluginManager = $idmap_plugin_manager;
foreach (NestedArray::mergeDeep($plugin_definition, $configuration) as $key => $value) {
foreach (NestedArray::mergeDeepArray([$plugin_definition, $configuration], TRUE) as $key => $value) {
$this->$key = $value;
}
}
......
......@@ -20,6 +20,7 @@ class MigrationPluginConfigurationTest extends KernelTestBase {
'migrate_drupal',
// Test with a simple migration.
'ban',
'locale',
];
/**
......@@ -27,9 +28,10 @@ class MigrationPluginConfigurationTest extends KernelTestBase {
*
* @dataProvider mergeProvider
*/
public function testConfigurationMerge($configuration, $expected) {
public function testConfigurationMerge($id, $configuration, $expected) {
/** @var \Drupal\migrate\Plugin\MigrationInterface $migration */
$migration = $this->container->get('plugin.manager.migration')->createInstance('d7_blocked_ips', $configuration);
$migration = $this->container->get('plugin.manager.migration')
->createInstance($id, $configuration);
$source_configuration = $migration->getSourceConfiguration();
$this->assertEquals($expected, $source_configuration);
}
......@@ -42,6 +44,7 @@ public function mergeProvider() {
// Tests adding new configuration to a migration.
[
// New configuration.
'd7_blocked_ips',
[
'source' => [
'constants' => [
......@@ -60,6 +63,7 @@ public function mergeProvider() {
// Tests overriding pre-existing configuration in a migration.
[
// New configuration.
'd7_blocked_ips',
[
'source' => [
'plugin' => 'a_different_plugin',
......@@ -70,6 +74,29 @@ public function mergeProvider() {
'plugin' => 'a_different_plugin',
],
],
// New configuration.
[
'locale_settings',
[
'source' => [
'plugin' => 'variable',
'variables' => [
'locale_cache_strings',
'locale_js_directory',
],
'source_module' => 'locale',
],
],
// Expected final source and process configuration.
[
'plugin' => 'variable',
'variables' => [
'locale_cache_strings',
'locale_js_directory',
],
'source_module' => 'locale',
],
],
];
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment