You are here

protected function ContentTranslationPendingRevisionTestBase::enableContentModeration in Drupal 9

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()

Enables content moderation for the test entity type and bundle.

3 calls to ContentTranslationPendingRevisionTestBase::enableContentModeration()
ContentTranslationOutdatedRevisionTranslationTest::setUp in core/modules/content_translation/tests/src/Functional/ContentTranslationOutdatedRevisionTranslationTest.php
ContentTranslationRevisionTranslationDeletionTest::setUp in core/modules/content_translation/tests/src/Functional/ContentTranslationRevisionTranslationDeletionTest.php
ContentTranslationUntranslatableFieldsTest::testHiddenWidgets in core/modules/content_translation/tests/src/Functional/ContentTranslationUntranslatableFieldsTest.php
Tests that hiding untranslatable field widgets works correctly.

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();
}