function MigrateExecutableTest::testProcessRowPipelineException

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

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);
}

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