You are here

protected function LanguageConfigurationTest::checkConfigurableLanguageWeight in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/language/src/Tests/LanguageConfigurationTest.php \Drupal\language\Tests\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/src/Tests/LanguageConfigurationTest.php
Functional tests for setting system language weight on adding, editing and deleting languages.

File

core/modules/language/src/Tests/LanguageConfigurationTest.php, line 192
Contains \Drupal\language\Tests\LanguageConfigurationTest.

Class

LanguageConfigurationTest
Adds and configures languages to check negotiation changes.

Namespace

Drupal\language\Tests

Code

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

  // Reset language list.
  \Drupal::languageManager()
    ->reset();
  $max_configurable_language_weight = $this
    ->getHighestConfigurableLanguageWeight();
  $replacements = array(
    '@event' => $state,
  );
  foreach (\Drupal::languageManager()
    ->getLanguages(LanguageInterface::STATE_LOCKED) as $locked_language) {
    $replacements['%language'] = $locked_language
      ->getName();
    $this
      ->assertTrue($locked_language
      ->getWeight() > $max_configurable_language_weight, format_string('System language %language has higher weight than configurable languages @event', $replacements));
  }
}