You are here

public function MigrationLookupTest::testTransformWithStubSkipping 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::testTransformWithStubSkipping()

@covers ::transform

File

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

Class

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

Namespace

Drupal\Tests\migrate\Unit\process

Code

public function testTransformWithStubSkipping() {
  $migration_plugin = $this
    ->prophesize(MigrationInterface::class);
  $migration_plugin_manager = $this
    ->prophesize(MigrationPluginManagerInterface::class);
  $destination_id_map = $this
    ->prophesize(MigrateIdMapInterface::class);
  $destination_migration = $this
    ->prophesize(MigrationInterface::class);
  $destination_migration
    ->getIdMap()
    ->willReturn($destination_id_map
    ->reveal());
  $destination_id_map
    ->lookupDestinationIds([
    1,
  ])
    ->willReturn(NULL);

  // Ensure the migration plugin manager returns our migration.
  $migration_plugin_manager
    ->createInstances(Argument::exact([
    'destination_migration',
  ]))
    ->willReturn([
    'destination_migration' => $destination_migration
      ->reveal(),
  ]);
  $configuration = [
    'no_stub' => TRUE,
    'migration' => 'destination_migration',
  ];
  $migration_plugin
    ->id()
    ->willReturn('actual_migration');
  $destination_migration
    ->getDestinationPlugin(TRUE)
    ->shouldNotBeCalled();
  $migration = MigrationLookup::create($this
    ->prepareContainer(), $configuration, '', [], $migration_plugin
    ->reveal());
  $result = $migration
    ->transform(1, $this->migrateExecutable, $this->row, '');
  $this
    ->assertNull($result);
}