function ContentTranslationLanguageChangeTest::setUp

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

Overrides NodeTestBase::setUp

File

core/modules/content_translation/tests/src/Functional/ContentTranslationLanguageChangeTest.php, line 46

Class

ContentTranslationLanguageChangeTest
Tests the content translation language that is set.

Namespace

Drupal\Tests\content_translation\Functional

Code

protected function setUp() : void {
    parent::setUp();
    $langcodes = [
        'de',
        'fr',
    ];
    foreach ($langcodes as $langcode) {
        static::createLanguageFromLangcode($langcode);
    }
    $this->drupalPlaceBlock('local_tasks_block');
    $user = $this->drupalCreateUser([
        'administer site configuration',
        'administer nodes',
        'create article content',
        'edit any article content',
        'delete any article content',
        'administer content translation',
        'translate any entity',
        'create content translations',
        'administer languages',
        'administer content types',
        'administer node fields',
    ]);
    $this->drupalLogin($user);
    // Enable translations for article.
    $this->enableContentTranslation('node', 'article');
    $this->rebuildContainer();
    $this->createImageField('field_image_field', 'node', 'article');
}

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