You are here

protected function ContentTranslationLinkTagTest::setUp in Drupal 9

Same name and namespace in other branches
  1. 8 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();
}