function ContentTranslationOperationsTest::setUp

Same name in other branches
  1. 9 core/modules/content_translation/tests/src/Functional/ContentTranslationOperationsTest.php \Drupal\Tests\content_translation\Functional\ContentTranslationOperationsTest::setUp()
  2. 10 core/modules/content_translation/tests/src/Functional/ContentTranslationOperationsTest.php \Drupal\Tests\content_translation\Functional\ContentTranslationOperationsTest::setUp()
  3. 11.x core/modules/content_translation/tests/src/Functional/ContentTranslationOperationsTest.php \Drupal\Tests\content_translation\Functional\ContentTranslationOperationsTest::setUp()

Overrides NodeTestBase::setUp

File

core/modules/content_translation/tests/src/Functional/ContentTranslationOperationsTest.php, line 51

Class

ContentTranslationOperationsTest
Tests the content translation operations available in the content listing.

Namespace

Drupal\Tests\content_translation\Functional

Code

protected function setUp() {
    parent::setUp();
    // Enable additional languages.
    $langcodes = [
        'es',
        'ast',
    ];
    foreach ($langcodes as $langcode) {
        ConfigurableLanguage::createFromLangcode($langcode)->save();
    }
    // Enable translation for the current entity type and ensure the change is
    // picked up.
    \Drupal::service('content_translation.manager')->setEnabled('node', 'article', TRUE);
    \Drupal::service('router.builder')->rebuild();
    $this->baseUser1 = $this->drupalCreateUser([
        'access content overview',
    ]);
    $this->baseUser2 = $this->drupalCreateUser([
        'access content overview',
        'create content translations',
        'update content translations',
        'delete content translations',
    ]);
}

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