diff --git a/core/modules/comment/tests/src/Functional/CommentLanguageTest.php b/core/modules/comment/tests/src/Functional/CommentLanguageTest.php index 213e4e04211194e72afa68c8ad89ad38757fac40..5da8ea42e10e00133eea43c76b16761f3d2f1599 100644 --- a/core/modules/comment/tests/src/Functional/CommentLanguageTest.php +++ b/core/modules/comment/tests/src/Functional/CommentLanguageTest.php @@ -73,7 +73,7 @@ protected function setUp(): void { $this->submitForm($edit, 'Save'); // Enable content language negotiation UI. - \Drupal::state()->set('language_test.content_language_type', TRUE); + \Drupal::keyValue('language_test')->set('content_language_type', TRUE); // Set interface language detection to user and content language detection // to URL. Disable inheritance from interface language to ensure content diff --git a/core/modules/language/tests/language_test/src/Hook/LanguageTestHooks.php b/core/modules/language/tests/language_test/src/Hook/LanguageTestHooks.php index 3a25b1608ea63f83f9b5342d8f712ec4fa1836f1..705137ff751be1a83a2fccc96d93f2dd5d575397 100644 --- a/core/modules/language/tests/language_test/src/Hook/LanguageTestHooks.php +++ b/core/modules/language/tests/language_test/src/Hook/LanguageTestHooks.php @@ -32,7 +32,7 @@ public function pageTop(): void { */ #[Hook('language_types_info')] public function languageTypesInfo() { - if (\Drupal::state()->get('language_test.language_types')) { + if (\Drupal::keyValue('language_test')->get('language_types')) { return [ 'test_language_type' => [ 'name' => t('Test'), @@ -53,7 +53,7 @@ public function languageTypesInfo() { */ #[Hook('language_types_info_alter')] public function languageTypesInfoAlter(array &$language_types): void { - if (\Drupal::state()->get('language_test.content_language_type')) { + if (\Drupal::keyValue('language_test')->get('content_language_type')) { $language_types[LanguageInterface::TYPE_CONTENT]['locked'] = FALSE; unset($language_types[LanguageInterface::TYPE_CONTENT]['fixed']); // By default languages are not configurable. Make @@ -72,7 +72,7 @@ public function languageTypesInfoAlter(array &$language_types): void { */ #[Hook('language_negotiation_info_alter')] public function languageNegotiationInfoAlter(array &$negotiation_info): void { - if (\Drupal::state()->get('language_test.language_negotiation_info_alter')) { + if (\Drupal::keyValue('language_test')->get('language_negotiation_info_alter')) { unset($negotiation_info[LanguageNegotiationUI::METHOD_ID]); } } diff --git a/core/modules/language/tests/src/Functional/LanguageNegotiationInfoTest.php b/core/modules/language/tests/src/Functional/LanguageNegotiationInfoTest.php index 2b4596e282ce5e455a1836767b4c0a5b6b279c1f..14e55ed1b5a8d88624dfa6f9d2fe56c7977641d3 100644 --- a/core/modules/language/tests/src/Functional/LanguageNegotiationInfoTest.php +++ b/core/modules/language/tests/src/Functional/LanguageNegotiationInfoTest.php @@ -51,18 +51,18 @@ protected function languageManager() { } /** - * Sets state flags for language_test module. + * Sets key/value pairs for language_test module. * * Ensures to correctly update data both in the child site and the test runner * environment. * * @param array $values - * The key/value pairs to set in state. + * The key/value pairs to set in the key value store. */ - protected function stateSet(array $values): void { - // Set the new state values. - $this->container->get('state')->setMultiple($values); - // Refresh in-memory static state/config caches and static variables. + protected function keysValuesSet(array $values): void { + // Set the new key value values. + $this->container->get('keyvalue')->get('language_test')->setMultiple($values); + // Refresh in-memory static key value/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. @@ -73,13 +73,13 @@ protected function stateSet(array $values): void { * Tests alterations to language types/negotiation info. */ public function testInfoAlterations(): void { - $this->stateSet([ + $this->keysValuesSet([ // Enable language_test type info. - 'language_test.language_types' => TRUE, + 'language_types' => TRUE, // Enable language_test negotiation info (not altered yet). - 'language_test.language_negotiation_info' => TRUE, + 'language_negotiation_info' => TRUE, // Alter LanguageInterface::TYPE_CONTENT to be configurable. - 'language_test.content_language_type' => TRUE, + 'content_language_type' => TRUE, ]); $this->container->get('module_installer')->install(['language_test']); $this->resetAll(); @@ -109,8 +109,8 @@ public function testInfoAlterations(): void { // Alter language negotiation info to remove interface language negotiation // method. - $this->stateSet([ - 'language_test.language_negotiation_info_alter' => TRUE, + $this->keysValuesSet([ + 'language_negotiation_info_alter' => TRUE, ]); $negotiation = $this->config('language.types')->get('negotiation.' . $type . '.enabled');