You are here

public function MigrateExecutableTest::testProcessRowPipelineException in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/migrate/tests/src/Unit/MigrateExecutableTest.php \Drupal\Tests\migrate\Unit\MigrateExecutableTest::testProcessRowPipelineException()

Tests the processRow pipeline exception.

File

core/modules/migrate/tests/src/Unit/MigrateExecutableTest.php, line 430

Class

MigrateExecutableTest
@coversDefaultClass \Drupal\migrate\MigrateExecutable @group migrate

Namespace

Drupal\Tests\migrate\Unit

Code

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
    ->expectException(MigrateException::class);
  $this
    ->expectExceptionMessage('Pipeline failed at plugin_id plugin for destination destination_id: transform_return_string received instead of an array,');
  $this->executable
    ->processRow($row);
}