function TranslationLinkTest::setUp

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

Overrides ContentTranslationTestBase::setUp

File

core/modules/content_translation/tests/src/Functional/Views/TranslationLinkTest.php, line 37

Class

TranslationLinkTest
Tests the content translation overview link field handler.

Namespace

Drupal\Tests\content_translation\Functional\Views

Code

protected function setUp() {
    // @todo Use entity_type once it has multilingual Views integration.
    $this->entityTypeId = 'user';
    parent::setUp();
    // Assign user 1  a language code so that the entity can be translated.
    $user = User::load(1);
    $user->langcode = 'en';
    $user->save();
    // Assign user 2 LANGCODE_NOT_SPECIFIED code so entity can't be translated.
    $user = User::load(2);
    $user->langcode = Language::LANGCODE_NOT_SPECIFIED;
    $user->save();
    ViewTestData::createTestViews(get_class($this), [
        'content_translation_test_views',
    ]);
}

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