You are here

public function MigrationLookupTest::testSuccessfulLookup in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/migrate/tests/src/Unit/process/MigrationLookupTest.php \Drupal\Tests\migrate\Unit\process\MigrationLookupTest::testSuccessfulLookup()
  2. 10 core/modules/migrate/tests/src/Unit/process/MigrationLookupTest.php \Drupal\Tests\migrate\Unit\process\MigrationLookupTest::testSuccessfulLookup()

Tests a successful lookup.

@dataProvider successfulLookupDataProvider

Parameters

array $source_id_values: The source id(s) of the migration map.

array $destination_id_values: The destination id(s) of the migration map.

string|array $source_value: The source value(s) for the migration process plugin.

string|array $expected_value: The expected value(s) of the migration process plugin.

Throws

\Drupal\migrate\MigrateSkipProcessException

File

core/modules/migrate/tests/src/Unit/process/MigrationLookupTest.php, line 162

Class

MigrationLookupTest
@coversDefaultClass \Drupal\migrate\Plugin\migrate\process\MigrationLookup @group migrate

Namespace

Drupal\Tests\migrate\Unit\process

Code

public function testSuccessfulLookup(array $source_id_values, array $destination_id_values, $source_value, $expected_value) {
  $migration_plugin = $this
    ->prophesize(MigrationInterface::class);
  $this->migrateLookup
    ->lookup('foobaz', $source_id_values)
    ->willReturn([
    $destination_id_values,
  ]);
  $configuration = [
    'migration' => 'foobaz',
  ];
  $migration = MigrationLookup::create($this
    ->prepareContainer(), $configuration, '', [], $migration_plugin
    ->reveal());
  $this
    ->assertSame($expected_value, $migration
    ->transform($source_value, $this->migrateExecutable, $this->row, 'foo'));
}