Commit b147d5e0 authored by catch's avatar catch

Issue #2886349 by quietone, PunamShelke, mikeryan, heddn: Invalid argument...

Issue #2886349 by quietone, PunamShelke, mikeryan, heddn: Invalid argument supplied for foreach() Migration.php:352
parent 798ae0c7
......@@ -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);
......
......@@ -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()
*
......
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