function MigrateExecutableTest::testProcessRow

Same name in other branches
  1. 8.9.x 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 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')
            ->willReturn([]);
        $plugins[$key][0]->expects($this->once())
            ->method('transform')
            ->willReturn($value);
    }
    $this->migration
        ->expects($this->once())
        ->method('getProcessPlugins')
        ->with(NULL)
        ->willReturn($plugins);
    $row = new Row();
    $this->executable
        ->processRow($row);
    foreach ($expected as $key => $value) {
        $this->assertSame($row->getDestinationProperty($key), $value);
    }
    $this->assertSameSize($expected, $row->getDestination());
}

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