function LocaleLocaleLookupTest::testLanguageFallbackDefaults

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

Tests language fallback defaults.

File

core/modules/locale/tests/src/Functional/LocaleLocaleLookupTest.php, line 65

Class

LocaleLocaleLookupTest
Tests LocaleLookup.

Namespace

Drupal\Tests\locale\Functional

Code

public function testLanguageFallbackDefaults() : void {
    $this->drupalGet('');
    // Ensure state of fallback languages persisted by
    // locale_test_language_fallback_candidates_locale_lookup_alter() is empty.
    $this->assertEquals([], \Drupal::state()->get('locale.test_language_fallback_candidates_locale_lookup_alter_candidates'));
    // Make sure there is enough information provided for alter hooks.
    $context = \Drupal::state()->get('locale.test_language_fallback_candidates_locale_lookup_alter_context');
    $this->assertEquals('fr', $context['langcode']);
    $this->assertEquals('locale_lookup', $context['operation']);
}

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