You are here

protected function ContentTranslationPendingRevisionTestBase::enableContentModeration in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/content_translation/tests/src/Functional/ContentTranslationPendingRevisionTestBase.php \Drupal\Tests\content_translation\Functional\ContentTranslationPendingRevisionTestBase::enableContentModeration()
  2. 9 core/modules/content_translation/tests/src/Functional/ContentTranslationPendingRevisionTestBase.php \Drupal\Tests\content_translation\Functional\ContentTranslationPendingRevisionTestBase::enableContentModeration()

Enables content moderation for the test entity type and bundle.

File

core/modules/content_translation/tests/src/Functional/ContentTranslationPendingRevisionTestBase.php, line 79

Class

ContentTranslationPendingRevisionTestBase
Base class for pending revision translation tests.

Namespace

Drupal\Tests\content_translation\Functional

Code

protected function enableContentModeration() {
  $this
    ->drupalLogin($this->rootUser);
  $workflow_id = 'editorial';
  $this
    ->drupalGet('/admin/config/workflow/workflows');
  $edit['bundles[' . $this->bundle . ']'] = TRUE;
  $this
    ->drupalGet('admin/config/workflow/workflows/manage/' . $workflow_id . '/type/' . $this->entityTypeId);
  $this
    ->submitForm($edit, 'Save');

  // Ensure the parent environment is up-to-date.
  // @see content_moderation_workflow_insert()
  \Drupal::service('entity_type.bundle.info')
    ->clearCachedBundles();
  \Drupal::service('entity_field.manager')
    ->clearCachedFieldDefinitions();

  /** @var \Drupal\Core\Routing\RouteBuilderInterface $router_builder */
  $router_builder = $this->container
    ->get('router.builder');
  $router_builder
    ->rebuildIfNeeded();
}