function MigrateStubTest::testCreateStub
Same name in this branch
- 8.9.x core/modules/migrate/tests/src/Kernel/MigrateStubTest.php \Drupal\Tests\migrate\Kernel\MigrateStubTest::testCreateStub()
Same name in other branches
- 9 core/modules/migrate/tests/src/Unit/MigrateStubTest.php \Drupal\Tests\migrate\Unit\MigrateStubTest::testCreateStub()
- 9 core/modules/migrate/tests/src/Kernel/MigrateStubTest.php \Drupal\Tests\migrate\Kernel\MigrateStubTest::testCreateStub()
- 10 core/modules/migrate/tests/src/Unit/MigrateStubTest.php \Drupal\Tests\migrate\Unit\MigrateStubTest::testCreateStub()
- 10 core/modules/migrate/tests/src/Kernel/MigrateStubTest.php \Drupal\Tests\migrate\Kernel\MigrateStubTest::testCreateStub()
- 11.x core/modules/migrate/tests/src/Unit/MigrateStubTest.php \Drupal\Tests\migrate\Unit\MigrateStubTest::testCreateStub()
- 11.x core/modules/migrate/tests/src/Kernel/MigrateStubTest.php \Drupal\Tests\migrate\Kernel\MigrateStubTest::testCreateStub()
Tests stubbing.
@covers ::createStub
File
-
core/
modules/ migrate/ tests/ src/ Unit/ MigrateStubTest.php, line 45
Class
- MigrateStubTest
- Tests the migrate stub service.
Namespace
Drupal\Tests\migrate\UnitCode
public function testCreateStub() {
$destination_plugin = $this->prophesize(MigrateDestinationInterface::class);
$destination_plugin->import(Argument::type(Row::class))
->willReturn([
'id' => 2,
]);
$source_plugin = $this->prophesize(MigrateSourceInterface::class);
$source_plugin->getIds()
->willReturn([
'id' => [
'type' => 'integer',
],
]);
$id_map = $this->prophesize(MigrateIdMapInterface::class);
$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,
], []));
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.