function MigrateLookupTest::testLookup
Same name in other branches
- 9 core/modules/migrate/tests/src/Unit/MigrateLookupTest.php \Drupal\Tests\migrate\Unit\MigrateLookupTest::testLookup()
- 8.9.x core/modules/migrate/tests/src/Unit/MigrateLookupTest.php \Drupal\Tests\migrate\Unit\MigrateLookupTest::testLookup()
- 10 core/modules/migrate/tests/src/Unit/MigrateLookupTest.php \Drupal\Tests\migrate\Unit\MigrateLookupTest::testLookup()
Tests the lookup function.
@covers ::lookup
File
-
core/
modules/ migrate/ tests/ src/ Unit/ MigrateLookupTest.php, line 29
Class
- MigrateLookupTest
- Provides unit testing for the migration lookup service.
Namespace
Drupal\Tests\migrate\UnitCode
public function testLookup() : void {
$source_ids = [
'id' => '1',
];
$destination_ids = [
[
2,
],
];
$id_map = $this->prophesize(MigrateIdMapInterface::class);
$id_map->lookupDestinationIds($source_ids)
->willReturn($destination_ids);
$destination = $this->prophesize(MigrateDestinationInterface::class);
$destination->getIds()
->willReturn([
'id' => [
'type' => 'integer',
],
]);
$migration = $this->prophesize(MigrationInterface::class);
$migration->getIdMap()
->willReturn($id_map->reveal());
$migration->getDestinationPlugin()
->willReturn($destination->reveal());
$plugin_manager = $this->prophesize(MigrationPluginManagerInterface::class);
$plugin_manager->createInstances('test_migration')
->willReturn([
$migration->reveal(),
]);
$lookup = new MigrateLookup($plugin_manager->reveal());
$this->assertSame([
[
'id' => 2,
],
], $lookup->lookup('test_migration', $source_ids));
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.