You are here

protected function LanguageConfigurationTest::checkConfigurableLanguageWeight in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/language/tests/src/Functional/LanguageConfigurationTest.php \Drupal\Tests\language\Functional\LanguageConfigurationTest::checkConfigurableLanguageWeight()
  2. 9 core/modules/language/tests/src/Functional/LanguageConfigurationTest.php \Drupal\Tests\language\Functional\LanguageConfigurationTest::checkConfigurableLanguageWeight()

Validates system languages are ordered after configurable languages.

Parameters

string $state: (optional) A string for customizing assert messages, containing the description of the state of the check, for example: 'after re-ordering'. Defaults to 'by default'.

File

core/modules/language/tests/src/Functional/LanguageConfigurationTest.php, line 202

Class

LanguageConfigurationTest
Adds and configures languages to check negotiation changes.

Namespace

Drupal\Tests\language\Functional

Code

protected function checkConfigurableLanguageWeight($state = 'by default') {

  // Reset language list.
  \Drupal::languageManager()
    ->reset();
  $max_configurable_language_weight = $this
    ->getHighestConfigurableLanguageWeight();
  foreach (\Drupal::languageManager()
    ->getLanguages(LanguageInterface::STATE_LOCKED) as $locked_language) {
    $this
      ->assertGreaterThan($max_configurable_language_weight, $locked_language
      ->getWeight(), sprintf('System language %s does not have higher weight than configurable languages %s', $locked_language
      ->getName(), $state));
  }
}