From 305de12898652ea2d361389d41dafc9120eac622 Mon Sep 17 00:00:00 2001
From: Matroskeen <matroskeen@3426249.no-reply.drupal.org>
Date: Tue, 18 Jan 2022 12:33:12 +0000
Subject: [PATCH] Check if shared_configuration key is used in migration

---
 migrate_plus.module                     | 2 +-
 tests/src/Kernel/MigrationGroupTest.php | 4 +++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/migrate_plus.module b/migrate_plus.module
index d7aa25f1..fdb00df9 100644
--- a/migrate_plus.module
+++ b/migrate_plus.module
@@ -61,7 +61,7 @@ function migrate_plus_migration_plugins_alter(array &$migrations) {
       continue;
     }
     foreach ($shared_configuration as $key => $group_value) {
-      $migration_value = $migrations[$id][$key];
+      $migration_value = $migrations[$id][$key] ?? NULL;
       // Where both the migration and the group provide arrays, replace
       // recursively (so each key collision is resolved in favor of the
       // migration).
diff --git a/tests/src/Kernel/MigrationGroupTest.php b/tests/src/Kernel/MigrationGroupTest.php
index f707f5bb..eb62bb45 100644
--- a/tests/src/Kernel/MigrationGroupTest.php
+++ b/tests/src/Kernel/MigrationGroupTest.php
@@ -30,6 +30,7 @@ class MigrationGroupTest extends KernelTestBase {
       'shared_configuration' => [
         // In migration, so will be overridden.
         'migration_tags' => ['Drupal 6'],
+        'audit' => TRUE,
         'source' => [
           'constants' => [
             // Not in migration, so will be added.
@@ -52,7 +53,7 @@ class MigrationGroupTest extends KernelTestBase {
         'load' => [],
         'migration_group' => $group_id,
         'label' => 'Unaffected by the group',
-          // Overrides group.
+        // Overrides group.
         'migration_tags' => ['Drupal 7'],
         'destination' => [],
         'source' => [],
@@ -74,6 +75,7 @@ class MigrationGroupTest extends KernelTestBase {
     $expected_config = [
       'label' => 'Unaffected by the group',
       'getMigrationTags' => ['Drupal 7'],
+      'isAuditable' => TRUE,
       'getSourceConfiguration' => [
         'plugin' => 'empty',
         'constants' => [
-- 
GitLab