function MigrateLookupTest::testMultipleMigrationLookup
Same name in other branches
- 9 core/modules/migrate/tests/src/Kernel/MigrateLookupTest.php \Drupal\Tests\migrate\Kernel\MigrateLookupTest::testMultipleMigrationLookup()
- 8.9.x core/modules/migrate/tests/src/Kernel/MigrateLookupTest.php \Drupal\Tests\migrate\Kernel\MigrateLookupTest::testMultipleMigrationLookup()
- 10 core/modules/migrate/tests/src/Kernel/MigrateLookupTest.php \Drupal\Tests\migrate\Kernel\MigrateLookupTest::testMultipleMigrationLookup()
Tests looking up against multiple migrations at once.
Throws
\Drupal\Component\Plugin\Exception\PluginException
\Drupal\migrate\MigrateException
File
-
core/
modules/ migrate/ tests/ src/ Kernel/ MigrateLookupTest.php, line 131
Class
- MigrateLookupTest
- Tests the Migrate Lookup service.
Namespace
Drupal\Tests\migrate\KernelCode
public function testMultipleMigrationLookup() : void {
$migrations = [
'sample_lookup_migration',
'sample_lookup_migration_2',
];
foreach ($migrations as $migration) {
$this->executeMigration($migration);
}
// Test numerically indexed source id.
$result = $this->migrateLookup
->lookup($migrations, [
17,
]);
$this->assertSame('1', $result[0]['nid']);
// Test associatively indexed source id.
$result = $this->migrateLookup
->lookup($migrations, [
'id' => 35,
]);
$this->assertSame('4', $result[0]['nid']);
// Test lookup not found.
$result = $this->migrateLookup
->lookup($migrations, [
1337,
]);
$this->assertSame([], $result);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.