You are here

public function MigrateLookupTest::testInvalidIdLookup in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/migrate/tests/src/Kernel/MigrateLookupTest.php \Drupal\Tests\migrate\Kernel\MigrateLookupTest::testInvalidIdLookup()

Tests an invalid lookup.

File

core/modules/migrate/tests/src/Kernel/MigrateLookupTest.php, line 72

Class

MigrateLookupTest
Tests the Migrate Lookup service.

Namespace

Drupal\Tests\migrate\Kernel

Code

public function testInvalidIdLookup() {
  $this
    ->executeMigration('sample_lookup_migration');
  $this
    ->expectException(MigrateException::class);
  $this
    ->expectExceptionMessage("Extra unknown items for map migrate_map_sample_lookup_migration in source IDs: array (\n  'invalid_id' => 25,\n)");

  // Test invalidly indexed source id.
  $this->migrateLookup
    ->lookup('sample_lookup_migration', [
    'invalid_id' => 25,
  ]);
}