You are here

protected function LanguageNegotiationInfoTest::checkFixedLanguageTypes in Drupal 8

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

Class

LanguageNegotiationInfoTest
Tests alterations to language types/negotiation info.

Namespace

Drupal\Tests\language\Functional

Code

protected function checkFixedLanguageTypes() {
  $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, new FormattableMarkup('language negotiation for %type is properly set up', [
        '%type' => $type,
      ]));
    }
  }
}