function BasicAuthTest::testLocale

Same name in other branches
  1. 8.9.x core/modules/basic_auth/tests/src/Functional/BasicAuthTest.php \Drupal\Tests\basic_auth\Functional\BasicAuthTest::testLocale()
  2. 10 core/modules/basic_auth/tests/src/Functional/BasicAuthTest.php \Drupal\Tests\basic_auth\Functional\BasicAuthTest::testLocale()
  3. 11.x 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);
}

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