function MigrateSourceTest::testPreRollback
Same name and namespace in other branches
- 11.x core/modules/migrate/tests/src/Unit/MigrateSourceTest.php \Drupal\Tests\migrate\Unit\MigrateSourceTest::testPreRollback()
Tests pre rollback.
File
-
core/
modules/ migrate/ tests/ src/ Unit/ MigrateSourceTest.php, line 448
Class
Namespace
Drupal\Tests\migrate\UnitCode
public function testPreRollback() : void {
$this->migrationConfiguration['id'] = 'test_migration';
$plugin_id = 'test_migration';
$migration = $this->getMigration();
// Verify that preRollback() sets the high water mark to NULL.
$key_value = $this->createMock(KeyValueStoreInterface::class);
$key_value->expects($this->once())
->method('set')
->with($plugin_id, NULL);
$key_value_factory = $this->createMock(KeyValueFactoryInterface::class);
$key_value_factory->expects($this->once())
->method('get')
->with('migrate:high_water')
->willReturn($key_value);
$container = new ContainerBuilder();
$container->set('keyvalue', $key_value_factory);
\Drupal::setContainer($container);
$source = new StubSourceGeneratorPlugin([], $plugin_id, [], $migration);
$source->preRollback(new MigrateRollbackEvent($migration));
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.