MigrateStub example

$migration = $this->prophesize(MigrationInterface::class);
    $migration->getIdMap()->willReturn($id_map->reveal());
    $migration->getDestinationPlugin(TRUE)->willReturn($destination_plugin->reveal());
    $migration->getProcessPlugins([])->willReturn([]);
    $migration->getProcess()->willReturn([]);
    $migration->getSourceConfiguration()->willReturn([]);
    $migration->getSourcePlugin()->willReturn($source_plugin->reveal());

    $this->migrationPluginManager->createInstances(['test_migration'])->willReturn([$migration->reveal()]);

    $stub = new MigrateStub($this->migrationPluginManager->reveal());

    $this->assertSame(['id' => 2]$stub->createStub('test_migration', ['id' => 1][]));
  }

  /** * Tests that an error is logged if the plugin manager throws an exception. */
  public function testExceptionOnPluginNotFound() {
    $this->migrationPluginManager->createInstances(['test_migration'])->willReturn([]);
    $this->expectException(PluginNotFoundException::class);
    $this->expectExceptionMessage("Plugin ID 'test_migration' was not found.");
    
Home | Imprint | This part of the site doesn't use cookies.