function MigrationTest::getMigration

Creates a mock Migration instance.

Return value

\Prophecy\Prophecy\ObjectProphecy A mock Migration instance.

Overrides MigrateTestCase::getMigration

File

core/modules/migrate/tests/src/Unit/process/MigrationTest.php, line 94

Class

MigrationTest
@coversDefaultClass \Drupal\migrate\Plugin\migrate\process\Migration @group migrate @group legacy

Namespace

Drupal\Tests\migrate\Unit\process

Code

protected function getMigration() {
    $id_map = $this->prophesize(MigrateIdMapInterface::class);
    $id_map->lookupDestinationIds([
        1,
    ])
        ->willReturn(NULL);
    $id_map->saveIdMapping(Argument::any(), Argument::any(), MigrateIdMapInterface::STATUS_NEEDS_UPDATE)
        ->willReturn(NULL);
    $migration = $this->prophesize(MigrationInterface::class);
    $migration->getIdMap()
        ->willReturn($id_map->reveal());
    return $migration;
}

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