function MigrationLookupTest::testTransformWithStubSkipping

Same name in other branches
  1. 9 core/modules/migrate/tests/src/Unit/process/MigrationLookupTest.php \Drupal\Tests\migrate\Unit\process\MigrationLookupTest::testTransformWithStubSkipping()
  2. 8.9.x core/modules/migrate/tests/src/Unit/process/MigrationLookupTest.php \Drupal\Tests\migrate\Unit\process\MigrationLookupTest::testTransformWithStubSkipping()
  3. 11.x 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 23

Class

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

Namespace

Drupal\Tests\migrate\Unit\process

Code

public function testTransformWithStubSkipping() : void {
    $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);
}

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