function ContentTranslationLinkTagTest::setUp

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

Overrides BrowserTestBase::setUp

File

core/modules/content_translation/tests/src/Functional/ContentTranslationLinkTagTest.php, line 43

Class

ContentTranslationLinkTagTest
Tests whether canonical link tags are present for content entities.

Namespace

Drupal\Tests\content_translation\Functional

Code

protected function setUp() : void {
    parent::setUp();
    // Set up user.
    $user = $this->drupalCreateUser([
        'view test entity',
        'view test entity translations',
        'administer entity_test content',
    ]);
    $this->drupalLogin($user);
    // Add additional languages.
    $this->langcodes = [
        'it',
        'fr',
    ];
    foreach ($this->langcodes as $langcode) {
        ConfigurableLanguage::createFromLangcode($langcode)->save();
    }
    // Rebuild the container so that the new languages are picked up by services
    // that hold a list of languages.
    $this->rebuildContainer();
}

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