You are here

protected function TwigTransTest::setUp in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/system/tests/src/Functional/Theme/TwigTransTest.php \Drupal\Tests\system\Functional\Theme\TwigTransTest::setUp()

Overrides BrowserTestBase::setUp

File

core/modules/system/tests/src/Functional/Theme/TwigTransTest.php, line 53

Class

TwigTransTest
Tests Twig "trans" tags.

Namespace

Drupal\Tests\system\Functional\Theme

Code

protected function setUp() : void {
  parent::setUp();

  // Setup test_theme.
  \Drupal::service('theme_installer')
    ->install([
    'test_theme',
  ]);
  $this
    ->config('system.theme')
    ->set('default', 'test_theme')
    ->save();

  // Create and log in as admin.
  $this->adminUser = $this
    ->drupalCreateUser([
    'administer languages',
    'access administration pages',
    'administer site configuration',
    'translate interface',
  ]);
  $this
    ->drupalLogin($this->adminUser);

  // Install languages.
  $this
    ->installLanguages();

  // Assign Lolspeak (xx) to be the default language.
  $this
    ->config('system.site')
    ->set('default_langcode', 'xx')
    ->save();
  $this
    ->rebuildContainer();

  // Check that lolspeak is the default language for the site.
  $this
    ->assertEquals('xx', \Drupal::languageManager()
    ->getDefaultLanguage()
    ->getId(), 'Lolspeak is the default language');
}