function MigrateExecutableTest::testProcessRow

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()
  3. 11.x 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[[api-linebreak]] @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));
}

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