diff --git a/core/modules/migrate/tests/src/Unit/MigrateExecutableTest.php b/core/modules/migrate/tests/src/Unit/MigrateExecutableTest.php index d6f2937..e65e629 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; @@ -421,36 +422,27 @@ public function testProcessRowEmptyPipeline() { /** * Tests the processRow pipeline exception. + * + * @expectedException \Drupal\migrate\MigrateException + * + * @expectedExceptionMessage Pipeline failed at plugin_id plugin for destination destination_id: transform_return_string received instead of an array, */ public function testProcessRowPipelineException() { - for ($key = 0; $key <= 1; $key++) { - $plugins['destination_id'][$key] = $this->getMock('Drupal\migrate\Plugin\MigrateProcessInterface'); - $plugins['destination_id'][$key]->expects($this->once()) - ->method('getPluginDefinition') - ->will($this->returnValue(['handle_multiples' => FALSE])); - $plugins['destination_id'][$key]->expects($this->atMost(1)) - ->method('transform') - ->will($this->returnValue('transform_return_string')); - $plugins['destination_id'][$key]->expects($this->atMost(1)) - ->method('multiple') - ->will($this->returnValue(TRUE)); - $plugins['destination_id'][$key]->expects($this->atMost(1)) - ->method('getPluginId') - ->will($this->returnValue('plugin_id')); - } + $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->expects($this->once()) ->method('getProcessPlugins') ->with(NULL) ->will($this->returnValue($plugins)); - $row = new Row(); - try { - $this->executable->processRow($row); - $this->fail('Pipeline exception should throw.'); - } - catch (MigrateException $e) { - $this->assertEquals('Pipeline failed at plugin_id plugin for destination destination_id: transform_return_string received instead of an array,', $e->getMessage()); - } + $this->executable->processRow($row); } /**