function MigrateExecutableTest::testProcessRowPipelineException

Same name and namespace in other branches
  1. 9 core/modules/migrate/tests/src/Unit/MigrateExecutableTest.php \Drupal\Tests\migrate\Unit\MigrateExecutableTest::testProcessRowPipelineException()
  2. 8.9.x core/modules/migrate/tests/src/Unit/MigrateExecutableTest.php \Drupal\Tests\migrate\Unit\MigrateExecutableTest::testProcessRowPipelineException()
  3. 11.x 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 331

Class

MigrateExecutableTest
@coversDefaultClass \Drupal\migrate\MigrateExecutable[[api-linebreak]] @group migrate

Namespace

Drupal\Tests\migrate\Unit

Code

public function testProcessRowPipelineException() : void {
  $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->reset()
    ->shouldBeCalled();
  $plugin->isPipelineStopped()
    ->willReturn(FALSE);
  $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);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.