function LanguageConfigurationTest::checkConfigurableLanguageWeight

Same name in other branches
  1. 9 core/modules/language/tests/src/Functional/LanguageConfigurationTest.php \Drupal\Tests\language\Functional\LanguageConfigurationTest::checkConfigurableLanguageWeight()
  2. 8.9.x core/modules/language/tests/src/Functional/LanguageConfigurationTest.php \Drupal\Tests\language\Functional\LanguageConfigurationTest::checkConfigurableLanguageWeight()
  3. 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') : void {
    // 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));
    }
}

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