function LanguageNegotiationInfoTest::checkFixedLanguageTypes

Same name and namespace in other branches
  1. 9 core/modules/language/tests/src/Functional/LanguageNegotiationInfoTest.php \Drupal\Tests\language\Functional\LanguageNegotiationInfoTest::checkFixedLanguageTypes()
  2. 8.9.x core/modules/language/tests/src/Functional/LanguageNegotiationInfoTest.php \Drupal\Tests\language\Functional\LanguageNegotiationInfoTest::checkFixedLanguageTypes()
  3. 10 core/modules/language/tests/src/Functional/LanguageNegotiationInfoTest.php \Drupal\Tests\language\Functional\LanguageNegotiationInfoTest::checkFixedLanguageTypes()

Check that language negotiation for fixed types matches the stored one.

1 call to LanguageNegotiationInfoTest::checkFixedLanguageTypes()
LanguageNegotiationInfoTest::testInfoAlterations in core/modules/language/tests/src/Functional/LanguageNegotiationInfoTest.php
Tests alterations to language types/negotiation info.

File

core/modules/language/tests/src/Functional/LanguageNegotiationInfoTest.php, line 172

Class

LanguageNegotiationInfoTest
Tests alterations to language types/negotiation info.

Namespace

Drupal\Tests\language\Functional

Code

protected function checkFixedLanguageTypes() : void {
  $configurable = $this->languageManager()
    ->getLanguageTypes();
  foreach ($this->languageManager()
    ->getDefinedLanguageTypesInfo() as $type => $info) {
    if (!in_array($type, $configurable) && isset($info['fixed'])) {
      $negotiation = $this->config('language.types')
        ->get('negotiation.' . $type . '.enabled');
      $equal = array_keys($negotiation) === array_values($info['fixed']);
      $this->assertTrue($equal, "language negotiation for {$type} is properly set up");
    }
  }
}

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