You are here

protected function DomainConfigTestBase::setUp in Domain Access 8

Overrides DomainTestBase::setUp

3 calls to DomainConfigTestBase::setUp()
DomainConfigAlterHookTest::setUp in domain_config/tests/src/Functional/DomainConfigAlterHookTest.php
Test setup.
DomainConfigUIOptionsTest::setUp in domain_config_ui/tests/src/Functional/DomainConfigUIOptionsTest.php
DomainConfigUIPermissionsTest::setUp in domain_config_ui/tests/src/Functional/DomainConfigUIPermissionsTest.php
3 methods override DomainConfigTestBase::setUp()
DomainConfigAlterHookTest::setUp in domain_config/tests/src/Functional/DomainConfigAlterHookTest.php
Test setup.
DomainConfigUIOptionsTest::setUp in domain_config_ui/tests/src/Functional/DomainConfigUIOptionsTest.php
DomainConfigUIPermissionsTest::setUp in domain_config_ui/tests/src/Functional/DomainConfigUIPermissionsTest.php

File

domain_config/tests/src/Functional/DomainConfigTestBase.php, line 46

Class

DomainConfigTestBase
Helper test methods for Domain Config testing.

Namespace

Drupal\Tests\domain_config\Functional

Code

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

  // Create and login user.
  $admin_user = $this
    ->drupalCreateUser([
    'administer languages',
    'access administration pages',
  ]);
  $this
    ->drupalLogin($admin_user);

  // Add language.
  $edit = [
    'predefined_langcode' => 'es',
  ];
  $this
    ->drupalGet('admin/config/regional/language/add');
  $this
    ->submitForm($edit, 'Add language');

  // Enable URL language detection and selection.
  $edit = [
    'language_interface[enabled][language-url]' => '1',
  ];
  $this
    ->drupalGet('admin/config/regional/language/detection');
  $this
    ->submitForm($edit, 'Save settings');
  $this
    ->drupalLogout();

  // In order to reflect the changes for a multilingual site in the container
  // we have to rebuild it.
  $this
    ->rebuildContainer();
  $es = \Drupal::entityTypeManager()
    ->getStorage('configurable_language')
    ->load('es');
  $this
    ->assertNotEmpty($es, 'Created test language.');
}