You are here

public function MigrateExecutableTest::testProcessRow in Drupal 10

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

Tests the processRow method.

File

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

Class

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

Namespace

Drupal\Tests\migrate\Unit

Code

public function testProcessRow() {
  $expected = [
    'test' => 'test destination',
    'test1' => 'test1 destination',
  ];
  foreach ($expected as $key => $value) {
    $plugins[$key][0] = $this
      ->createMock('Drupal\\migrate\\Plugin\\MigrateProcessInterface');
    $plugins[$key][0]
      ->expects($this
      ->once())
      ->method('getPluginDefinition')
      ->will($this
      ->returnValue([]));
    $plugins[$key][0]
      ->expects($this
      ->once())
      ->method('transform')
      ->will($this
      ->returnValue($value));
  }
  $this->migration
    ->expects($this
    ->once())
    ->method('getProcessPlugins')
    ->with(NULL)
    ->will($this
    ->returnValue($plugins));
  $row = new Row();
  $this->executable
    ->processRow($row);
  foreach ($expected as $key => $value) {
    $this
      ->assertSame($row
      ->getDestinationProperty($key), $value);
  }
  $this
    ->assertSameSize($expected, $row
    ->getDestination());
}