protected function LanguageNegotiationInfoTest::checkFixedLanguageTypes

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

1 call to LanguageNegotiationInfoTest::checkFixedLanguageTypes()
LanguageNegotiationInfoTest::testInfoAlterations in drupal/core/modules/language/lib/Drupal/language/Tests/LanguageNegotiationInfoTest.php
Tests alterations to language types/negotiation info.

File

drupal/core/modules/language/lib/Drupal/language/Tests/LanguageNegotiationInfoTest.php, line 159
Definition of Drupal\language\Tests\LanguageNegotiationInfoTest.

Class

LanguageNegotiationInfoTest
Functional test for language types/negotiation info.

Namespace

Drupal\language\Tests

Code

protected function checkFixedLanguageTypes() {
  drupal_static_reset('language_types_info');
  foreach (language_types_info() as $type => $info) {
    if (isset($info['fixed'])) {
      $negotiation = variable_get("language_negotiation_{$type}", array());
      $equal = count($info['fixed']) == count($negotiation);
      while ($equal && (list($id) = each($negotiation))) {
        list(, $info_id) = each($info['fixed']);
        $equal = $info_id == $id;
      }
      $this
        ->assertTrue($equal, format_string('language negotiation for %type is properly set up', array(
        '%type' => $type,
      )));
    }
  }
}