diff --git a/core/modules/migrate/src/Plugin/Migration.php b/core/modules/migrate/src/Plugin/Migration.php index aa0c94c6c231d2907211492eba379d888d8dc58f..a946033ffd1dbc80ba3841ad82ab1195729d89bd 100644 --- a/core/modules/migrate/src/Plugin/Migration.php +++ b/core/modules/migrate/src/Plugin/Migration.php @@ -363,6 +363,9 @@ public function getProcessPlugins(array $process = NULL) { $this->processPlugins[$index] = []; foreach ($this->getProcessNormalized($process) as $property => $configurations) { $this->processPlugins[$index][$property] = []; + if (!is_array($configurations) && !$this->processPlugins[$index][$property]) { + throw new MigrateException(sprintf("Process configuration for '$property' must be an array", $property)); + } foreach ($configurations as $configuration) { if (isset($configuration['source'])) { $this->processPlugins[$index][$property][] = $this->processPluginManager->createInstance('get', $configuration, $this); diff --git a/core/modules/migrate/tests/src/Kernel/Plugin/MigrationTest.php b/core/modules/migrate/tests/src/Kernel/Plugin/MigrationTest.php index 85ec74f8e619fc264a7c0260187e9e25da0c9075..aceb73e807de5bf3b1448cdea102b888ff4925d6 100644 --- a/core/modules/migrate/tests/src/Kernel/Plugin/MigrationTest.php +++ b/core/modules/migrate/tests/src/Kernel/Plugin/MigrationTest.php @@ -41,6 +41,24 @@ public function testGetProcessPluginsException() { $migration->getProcessPlugins(['foobar' => ['plugin' => 'get']]); } + /** + * Tests Migration::getDestinationPlugin() + * + * @covers ::getDestinationPlugin + */ + public function testGetProcessPluginsExceptionMessage() { + // Test with an invalid process pipeline. + $plugin_definition = [ + 'process' => [ + 'dest1' => 123, + ], + ]; + $migration = \Drupal::service('plugin.manager.migration')->createStubMigration($plugin_definition); + $this->expectException(MigrateException::class); + $this->expectExceptionMessage("Process configuration for 'dest1' must be an array"); + $migration->getProcessPlugins(); + } + /** * Tests Migration::getMigrationDependencies() *