function PathLanguageUiTest::setUp

Same name in other branches
  1. 9 core/modules/path/tests/src/Functional/PathLanguageUiTest.php \Drupal\Tests\path\Functional\PathLanguageUiTest::setUp()
  2. 8.9.x core/modules/path/tests/src/Functional/PathLanguageUiTest.php \Drupal\Tests\path\Functional\PathLanguageUiTest::setUp()
  3. 11.x core/modules/path/tests/src/Functional/PathLanguageUiTest.php \Drupal\Tests\path\Functional\PathLanguageUiTest::setUp()

Overrides PathTestBase::setUp

File

core/modules/path/tests/src/Functional/PathLanguageUiTest.php, line 29

Class

PathLanguageUiTest
Confirm that the Path module user interface works with languages.

Namespace

Drupal\Tests\path\Functional

Code

protected function setUp() : void {
    parent::setUp();
    // Create and log in user.
    $web_user = $this->drupalCreateUser([
        'edit any page content',
        'create page content',
        'administer url aliases',
        'create url aliases',
        'administer languages',
        'access administration pages',
    ]);
    $this->drupalLogin($web_user);
    // Enable French language.
    $edit = [];
    $edit['predefined_langcode'] = 'fr';
    $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');
}

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