function MigrateLookupTest::testInvalidIdLookup

Same name in other branches
  1. 8.9.x core/modules/migrate/tests/src/Kernel/MigrateLookupTest.php \Drupal\Tests\migrate\Kernel\MigrateLookupTest::testInvalidIdLookup()
  2. 10 core/modules/migrate/tests/src/Kernel/MigrateLookupTest.php \Drupal\Tests\migrate\Kernel\MigrateLookupTest::testInvalidIdLookup()
  3. 11.x 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 71

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,
    ]);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.