Skip to content
Snippets Groups Projects
Unverified Commit 18059771 authored by Alex Pott's avatar Alex Pott
Browse files

Issue #2800715 by dcam, shashikant_chauhan, mikeryan, quietone, alexpott:...

Issue #2800715 by dcam, shashikant_chauhan, mikeryan, quietone, alexpott: Reset highwater mark *before* rolling back

(cherry picked from commit 420f7b2f)
parent bd08e821
No related branches found
No related tags found
No related merge requests found
Pipeline #496858 passed with warnings
Pipeline: drupal

#496886

    Pipeline: drupal

    #496873

      Pipeline: drupal

      #496862

        ......@@ -609,15 +609,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.
        }
        /**
        ......
        ......@@ -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;
        ......@@ -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));
        }
        }
        /**
        ......
        0% Loading or .
        You are about to add 0 people to the discussion. Proceed with caution.
        Please register or to comment