diff --git a/core/modules/migrate/src/MigrateExecutable.php b/core/modules/migrate/src/MigrateExecutable.php index 9d48618f58c91b7d740cb8fe4364541bb4c0e8ed..e8316e4129a079f487d6b56faf772eb0134b9291 100644 --- a/core/modules/migrate/src/MigrateExecutable.php +++ b/core/modules/migrate/src/MigrateExecutable.php @@ -358,7 +358,7 @@ public function processRow(Row $row, array $process = NULL, $value = NULL) { if ($multiple && !$definition['handle_multiples']) { $new_value = []; if (!is_array($value)) { - throw new MigrateException(sprintf('Pipeline failed for destination %s: %s got instead of an array,', $destination, $value)); + throw new MigrateException(sprintf('Pipeline failed at %s plugin for destination %s: %s received instead of an array,', $plugin->getPluginId(), $destination, $value)); } $break = FALSE; foreach ($value as $scalar_value) { diff --git a/core/modules/migrate/tests/src/Unit/MigrateExecutableTest.php b/core/modules/migrate/tests/src/Unit/MigrateExecutableTest.php index ff320df6c4ee9f05683ef5abcd3198b470dfdd2f..5e7cbaca4ca0056e8065c544afd48614acd519f9 100644 --- a/core/modules/migrate/tests/src/Unit/MigrateExecutableTest.php +++ b/core/modules/migrate/tests/src/Unit/MigrateExecutableTest.php @@ -3,6 +3,7 @@ namespace Drupal\Tests\migrate\Unit; use Drupal\Component\Utility\Html; +use Drupal\migrate\Plugin\MigrateProcessInterface; use Drupal\migrate\Plugin\MigrationInterface; use Drupal\migrate\Plugin\MigrateIdMapInterface; use Drupal\migrate\MigrateException; @@ -419,6 +420,25 @@ public function testProcessRowEmptyPipeline() { $this->assertSame($row->getDestination(), []); } + /** + * Tests the processRow pipeline exception. + */ + public function testProcessRowPipelineException() { + $row = new Row(); + $plugin = $this->prophesize(MigrateProcessInterface::class); + $plugin->getPluginDefinition()->willReturn(['handle_multiples' => FALSE]); + $plugin->transform(NULL, $this->executable, $row, 'destination_id') + ->willReturn('transform_return_string'); + $plugin->multiple()->willReturn(TRUE); + $plugin->getPluginId()->willReturn('plugin_id'); + $plugin = $plugin->reveal(); + $plugins['destination_id'] = [$plugin, $plugin]; + $this->migration->method('getProcessPlugins')->willReturn($plugins); + + $this->setExpectedException(MigrateException::class, 'Pipeline failed at plugin_id plugin for destination destination_id: transform_return_string received instead of an array,'); + $this->executable->processRow($row); + } + /** * Returns a mock migration source instance. *