You are here

protected function ContentTranslationTestBase::enableTranslation in Drupal 8

Same name in this branch
  1. 8 core/modules/content_translation/src/Tests/ContentTranslationTestBase.php \Drupal\content_translation\Tests\ContentTranslationTestBase::enableTranslation()
  2. 8 core/modules/content_translation/tests/src/Functional/ContentTranslationTestBase.php \Drupal\Tests\content_translation\Functional\ContentTranslationTestBase::enableTranslation()

Enables translation for the current entity type and bundle.

1 call to ContentTranslationTestBase::enableTranslation()
ContentTranslationTestBase::setUp in core/modules/content_translation/src/Tests/ContentTranslationTestBase.php
Sets up a Drupal site for running functional and integration tests.

File

core/modules/content_translation/src/Tests/ContentTranslationTestBase.php, line 173

Class

ContentTranslationTestBase
Base class for content translation tests.

Namespace

Drupal\content_translation\Tests

Code

protected function enableTranslation() {

  // Enable translation for the current entity type and ensure the change is
  // picked up.
  \Drupal::service('content_translation.manager')
    ->setEnabled($this->entityTypeId, $this->bundle, TRUE);
  \Drupal::entityTypeManager()
    ->clearCachedDefinitions();
  \Drupal::service('router.builder')
    ->rebuild();
}