You are here

public function BasicAuthTest::testLocale in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/basic_auth/tests/src/Functional/BasicAuthTest.php \Drupal\Tests\basic_auth\Functional\BasicAuthTest::testLocale()
  2. 9 core/modules/basic_auth/tests/src/Functional/BasicAuthTest.php \Drupal\Tests\basic_auth\Functional\BasicAuthTest::testLocale()

Tests compatibility with locale/UI translation.

File

core/modules/basic_auth/tests/src/Functional/BasicAuthTest.php, line 159

Class

BasicAuthTest
Tests for BasicAuth authentication provider.

Namespace

Drupal\Tests\basic_auth\Functional

Code

public function testLocale() {
  ConfigurableLanguage::createFromLangcode('de')
    ->save();
  $this
    ->config('system.site')
    ->set('default_langcode', 'de')
    ->save();
  $account = $this
    ->drupalCreateUser();
  $url = Url::fromRoute('router_test.11');
  $this
    ->basicAuthGet($url, $account
    ->getAccountName(), $account->pass_raw);
  $this
    ->assertSession()
    ->pageTextContains($account
    ->getAccountName());
  $this
    ->assertSession()
    ->statusCodeEquals(200);
}