You are here

protected function LanguageConfigurationTest::checkConfigurableLanguageWeight in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/language/tests/src/Functional/LanguageConfigurationTest.php \Drupal\Tests\language\Functional\LanguageConfigurationTest::checkConfigurableLanguageWeight()
  2. 10 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'.

1 call to LanguageConfigurationTest::checkConfigurableLanguageWeight()
LanguageConfigurationTest::testLanguageConfigurationWeight in core/modules/language/tests/src/Functional/LanguageConfigurationTest.php
Functional tests for setting system language weight on adding, editing and deleting languages.

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));
  }
}