You are here

public function MigrateExecutableTest::testProcessRow 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::testProcessRow()
  2. 10 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 388

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
    ->assertSame(count($row
    ->getDestination()), count($expected));
}