You are here

protected function TwigTransTest::setUp in Drupal 8

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

Class

TwigTransTest
Tests Twig "trans" tags.

Namespace

Drupal\Tests\system\Functional\Theme

Code

protected function setUp() {
  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
    ->assertEqual(\Drupal::languageManager()
    ->getDefaultLanguage()
    ->getId(), 'xx', 'Lolspeak is the default language');
}