function TwigTransTest::setUp

Same name in other branches
  1. 9 core/modules/system/tests/src/Functional/Theme/TwigTransTest.php \Drupal\Tests\system\Functional\Theme\TwigTransTest::setUp()
  2. 8.9.x core/modules/system/tests/src/Functional/Theme/TwigTransTest.php \Drupal\Tests\system\Functional\Theme\TwigTransTest::setUp()
  3. 10 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 56

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');
}

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