You are here

protected function TestBase::doMigration in Workbench Moderation to Content Moderation 8.2

Migrates from Workbench Moderation to Content Moderation.

6 calls to TestBase::doMigration()
TestBase::testMultipleRevisionsWithNewTranslation in tests/src/Functional/TestBase.php
Migrates an entity with several revisions, one of which adds a translation.
TestBase::testMultipleTranslatedMixedRevisions in tests/src/Functional/TestBase.php
Migrates an entity with several revisions and translations.
TestBase::testMultipleTranslatedRevisions in tests/src/Functional/TestBase.php
Migrates an entity with several revisions, all of which are translated.
TestBase::testMultipleUntranslatedRevisions in tests/src/Functional/TestBase.php
Migrates an entity with several revisions, but no translations.
TestBase::testSingleTranslatedRevision in tests/src/Functional/TestBase.php
Migrates an entity with translations, but only one revision.

... See full list

File

tests/src/Functional/TestBase.php, line 46

Class

TestBase

Namespace

Drupal\Tests\wbm2cm\Functional

Code

protected function doMigration() {
  wbm2cm_install();
  $entity_type_id = $this->storage
    ->getEntityTypeId();
  $this
    ->execute($entity_type_id, 'save');
  $this
    ->execute($entity_type_id, 'clear');

  /** @var \Drupal\Core\Extension\ModuleInstallerInterface $module_installer */
  $module_installer = $this->container
    ->get('module_installer');
  $module_installer
    ->uninstall([
    'workbench_moderation',
  ]);
  $module_installer
    ->install([
    'content_moderation',
  ]);

  // Ensure we don't have a stale definition of the moderation_state field in
  // our memory space.
  $this->container
    ->get('entity_field.manager')
    ->clearCachedFieldDefinitions();

  // Ensure we don't have a stale static entity cache in our memory space.
  $this->storage
    ->resetCache();
  $this
    ->execute($entity_type_id, 'restore');

  // Reload the storage in order to clear any cached table mappings.
  $this->storage = $this->container
    ->get('entity_type.manager')
    ->getStorage($entity_type_id);
}