Loading core/modules/migrate/src/Plugin/migrate/source/SourcePluginBase.php +3 −3 Original line number Diff line number Diff line Loading @@ -608,15 +608,15 @@ protected function getHighWaterField() { * {@inheritdoc} */ public function preRollback(MigrateRollbackEvent $event) { // Nothing to do in this implementation. // Reset the high-water mark. $this->saveHighWater(NULL); } /** * {@inheritdoc} */ public function postRollback(MigrateRollbackEvent $event) { // Reset the high-water mark. $this->saveHighWater(NULL); // Nothing to do in this implementation. } /** Loading core/modules/migrate/tests/src/Unit/MigrateSourceTest.php +27 −0 Original line number Diff line number Diff line Loading @@ -9,6 +9,7 @@ use Drupal\Core\Extension\ModuleHandlerInterface; use Drupal\Core\KeyValueStore\KeyValueFactoryInterface; use Drupal\Core\KeyValueStore\KeyValueStoreInterface; use Drupal\migrate\Event\MigrateRollbackEvent; use Drupal\migrate\MigrateException; use Drupal\migrate\MigrateExecutable; use Drupal\migrate\MigrateSkipRowException; Loading Loading @@ -448,6 +449,32 @@ protected function getMigrateExecutable($migration) { return new MigrateExecutable($migration, $message, $event_dispatcher); } /** * @covers ::preRollback */ 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)); } } /** Loading Loading
core/modules/migrate/src/Plugin/migrate/source/SourcePluginBase.php +3 −3 Original line number Diff line number Diff line Loading @@ -608,15 +608,15 @@ protected function getHighWaterField() { * {@inheritdoc} */ public function preRollback(MigrateRollbackEvent $event) { // Nothing to do in this implementation. // Reset the high-water mark. $this->saveHighWater(NULL); } /** * {@inheritdoc} */ public function postRollback(MigrateRollbackEvent $event) { // Reset the high-water mark. $this->saveHighWater(NULL); // Nothing to do in this implementation. } /** Loading
core/modules/migrate/tests/src/Unit/MigrateSourceTest.php +27 −0 Original line number Diff line number Diff line Loading @@ -9,6 +9,7 @@ use Drupal\Core\Extension\ModuleHandlerInterface; use Drupal\Core\KeyValueStore\KeyValueFactoryInterface; use Drupal\Core\KeyValueStore\KeyValueStoreInterface; use Drupal\migrate\Event\MigrateRollbackEvent; use Drupal\migrate\MigrateException; use Drupal\migrate\MigrateExecutable; use Drupal\migrate\MigrateSkipRowException; Loading Loading @@ -448,6 +449,32 @@ protected function getMigrateExecutable($migration) { return new MigrateExecutable($migration, $message, $event_dispatcher); } /** * @covers ::preRollback */ 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)); } } /** Loading