function MigrationLookupTest::testMultipleMigrations
Same name in other branches
- 9 core/modules/migrate/tests/src/Unit/process/MigrationLookupTest.php \Drupal\Tests\migrate\Unit\process\MigrationLookupTest::testMultipleMigrations()
- 10 core/modules/migrate/tests/src/Unit/process/MigrationLookupTest.php \Drupal\Tests\migrate\Unit\process\MigrationLookupTest::testMultipleMigrations()
Tests processing multiple migrations and source IDs.
File
-
core/
modules/ migrate/ tests/ src/ Unit/ process/ MigrationLookupTest.php, line 293
Class
- MigrationLookupTest
- @coversDefaultClass \Drupal\migrate\Plugin\migrate\process\MigrationLookup @group migrate
Namespace
Drupal\Tests\migrate\Unit\processCode
public function testMultipleMigrations() : void {
$migration_plugin = $this->prophesize(MigrationInterface::class);
$this->migrateLookup
->lookup('example', [
1,
])
->willReturn([
[
2,
],
]);
$this->migrateLookup
->lookup('example', [
2,
])
->willReturn([]);
$this->migrateLookup
->lookup('foobar', [
1,
2,
])
->willReturn([]);
$this->migrateLookup
->lookup('foobar', [
3,
4,
])
->willReturn([
[
5,
],
]);
$configuration = [
'migration' => [
'foobar',
'example',
],
'source_ids' => [
'foobar' => [
'foo',
'bar',
],
],
];
$migration = MigrationLookup::create($this->prepareContainer(), $configuration, '', [], $migration_plugin->reveal());
$row1 = $this->row;
$row2 = clone $this->row;
$row1->expects($this->any())
->method('getMultiple')
->willReturn([
1,
2,
]);
$result = $migration->transform([
1,
], $this->migrateExecutable, $row1, '');
$this->assertEquals(2, $result);
$row2->expects($this->any())
->method('getMultiple')
->willReturn([
3,
4,
]);
$result = $migration->transform([
2,
], $this->migrateExecutable, $row2, '');
$this->assertEquals(5, $result);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.