function LanguageNegotiationInfoTest::stateSet

Same name in other branches
  1. 9 core/modules/language/tests/src/Functional/LanguageNegotiationInfoTest.php \Drupal\Tests\language\Functional\LanguageNegotiationInfoTest::stateSet()
  2. 8.9.x core/modules/language/tests/src/Functional/LanguageNegotiationInfoTest.php \Drupal\Tests\language\Functional\LanguageNegotiationInfoTest::stateSet()
  3. 11.x core/modules/language/tests/src/Functional/LanguageNegotiationInfoTest.php \Drupal\Tests\language\Functional\LanguageNegotiationInfoTest::stateSet()

Sets state flags for language_test module.

Ensures to correctly update data both in the child site and the test runner environment.

Parameters

array $values: The key/value pairs to set in state.

1 call to LanguageNegotiationInfoTest::stateSet()
LanguageNegotiationInfoTest::testInfoAlterations in core/modules/language/tests/src/Functional/LanguageNegotiationInfoTest.php
Tests alterations to language types/negotiation info.

File

core/modules/language/tests/src/Functional/LanguageNegotiationInfoTest.php, line 62

Class

LanguageNegotiationInfoTest
Tests alterations to language types/negotiation info.

Namespace

Drupal\Tests\language\Functional

Code

protected function stateSet(array $values) {
    // Set the new state values.
    $this->container
        ->get('state')
        ->setMultiple($values);
    // Refresh in-memory static state/config caches and static variables.
    $this->refreshVariables();
    // Refresh/rewrite language negotiation configuration, in order to pick up
    // the manipulations performed by language_test module's info alter hooks.
    $this->container
        ->get('language_negotiator')
        ->purgeConfiguration();
}

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