public function MigrateLookupTest::testSingleLookup in Drupal 9
Same name and namespace in other branches
- 8 core/modules/migrate/tests/src/Kernel/MigrateLookupTest.php \Drupal\Tests\migrate\Kernel\MigrateLookupTest::testSingleLookup()
- 10 core/modules/migrate/tests/src/Kernel/MigrateLookupTest.php \Drupal\Tests\migrate\Kernel\MigrateLookupTest::testSingleLookup()
Tests scenarios around single id lookups.
File
- core/
modules/ migrate/ tests/ src/ Kernel/ MigrateLookupTest.php, line 52
Class
- MigrateLookupTest
- Tests the Migrate Lookup service.
Namespace
Drupal\Tests\migrate\KernelCode
public function testSingleLookup() {
$this
->executeMigration('sample_lookup_migration');
// Test numerically indexed source id.
$result = $this->migrateLookup
->lookup('sample_lookup_migration', [
17,
]);
$this
->assertSame('1', $result[0]['nid']);
// Test associatively indexed source id.
$result = $this->migrateLookup
->lookup('sample_lookup_migration', [
'id' => 25,
]);
$this
->assertSame('2', $result[0]['nid']);
// Test lookup not found.
$result = $this->migrateLookup
->lookup('sample_lookup_migration', [
1337,
]);
$this
->assertSame([], $result);
}