Loading core/modules/comment/tests/src/Functional/CommentLanguageTest.php +1 −1 Original line number Diff line number Diff line Loading @@ -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 Loading core/modules/language/tests/language_test/src/Hook/LanguageTestHooks.php +3 −3 Original line number Diff line number Diff line Loading @@ -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'), Loading @@ -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 Loading @@ -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]); } } Loading core/modules/language/tests/src/Functional/LanguageNegotiationInfoTest.php +12 −12 Original line number Diff line number Diff line Loading @@ -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. Loading @@ -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(); Loading Loading @@ -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'); Loading Loading
core/modules/comment/tests/src/Functional/CommentLanguageTest.php +1 −1 Original line number Diff line number Diff line Loading @@ -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 Loading
core/modules/language/tests/language_test/src/Hook/LanguageTestHooks.php +3 −3 Original line number Diff line number Diff line Loading @@ -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'), Loading @@ -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 Loading @@ -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]); } } Loading
core/modules/language/tests/src/Functional/LanguageNegotiationInfoTest.php +12 −12 Original line number Diff line number Diff line Loading @@ -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. Loading @@ -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(); Loading Loading @@ -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'); Loading