function ContentTranslationPendingRevisionTestBase::enableContentModeration

Same name in other branches
  1. 9 core/modules/content_translation/tests/src/Functional/ContentTranslationPendingRevisionTestBase.php \Drupal\Tests\content_translation\Functional\ContentTranslationPendingRevisionTestBase::enableContentModeration()
  2. 8.9.x core/modules/content_translation/tests/src/Functional/ContentTranslationPendingRevisionTestBase.php \Drupal\Tests\content_translation\Functional\ContentTranslationPendingRevisionTestBase::enableContentModeration()
  3. 11.x 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.

4 calls to ContentTranslationPendingRevisionTestBase::enableContentModeration()
ContentTranslationNewTranslationWithExistingRevisionsTest::setUp in core/modules/content_translation/tests/src/Functional/ContentTranslationNewTranslationWithExistingRevisionsTest.php
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 81

Class

ContentTranslationPendingRevisionTestBase
Base class for pending revision translation tests.

Namespace

Drupal\Tests\content_translation\Functional

Code

protected function enableContentModeration() {
    $perms = array_merge(parent::getAdministratorPermissions(), [
        'administer workflows',
        'view latest version',
    ]);
    $this->rootUser = $this->drupalCreateUser($perms);
    $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();
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.