You are here

protected function PathLanguageUiTest::setUp in Drupal 9

Same name and namespace in other branches
  1. 8 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 26

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