You are here

public function BasicAuthTest::testLocale in Drupal 8

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

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
    ->assertText($account
    ->getAccountName(), 'Account name is displayed.');
  $this
    ->assertSession()
    ->statusCodeEquals(200);
}