You are here

public function MigrateExecutableTest::testProcessRow in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 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 381
Contains \Drupal\Tests\migrate\Unit\MigrateExecutableTest.

Class

MigrateExecutableTest
@coversDefaultClass \Drupal\Tests\migrate\Unit\MigrateExecutableTest @group migrate

Namespace

Drupal\Tests\migrate\Unit

Code

public function testProcessRow() {
  $expected = array(
    'test' => 'test destination',
    'test1' => 'test1 destination',
  );
  foreach ($expected as $key => $value) {
    $plugins[$key][0] = $this
      ->getMock('Drupal\\migrate\\Plugin\\MigrateProcessInterface');
    $plugins[$key][0]
      ->expects($this
      ->once())
      ->method('getPluginDefinition')
      ->will($this
      ->returnValue(array()));
    $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(array(), array());
  $this->executable
    ->processRow($row);
  foreach ($expected as $key => $value) {
    $this
      ->assertSame($row
      ->getDestinationProperty($key), $value);
  }
  $this
    ->assertSame(count($row
    ->getDestination()), count($expected));
}