From 8c01b91e2036385115e6473d94a85930d22fe890 Mon Sep 17 00:00:00 2001 From: Dave Long <dave@longwaveconsulting.com> Date: Fri, 10 Nov 2023 23:38:02 +0000 Subject: [PATCH] Issue #3384935 by vbouchet: ContactLanguageTest should use API to set up language --- .../tests/src/Functional/ContactLanguageTest.php | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/core/modules/contact/tests/src/Functional/ContactLanguageTest.php b/core/modules/contact/tests/src/Functional/ContactLanguageTest.php index 045dd60e91d3..dc864a290a0b 100644 --- a/core/modules/contact/tests/src/Functional/ContactLanguageTest.php +++ b/core/modules/contact/tests/src/Functional/ContactLanguageTest.php @@ -2,6 +2,8 @@ namespace Drupal\Tests\contact\Functional; +use Drupal\Core\Language\LanguageInterface; +use Drupal\language\Entity\ContentLanguageSettings; use Drupal\Tests\BrowserTestBase; /** @@ -54,12 +56,11 @@ public function testContactLanguage() { $this->assertSession()->statusCodeEquals(200); $this->assertSession()->fieldNotExists('edit-langcode-0-value'); - // Enable language select from content language settings page. - $settings_path = 'admin/config/regional/content-language'; - $edit['entity_types[contact_message]'] = TRUE; - $edit['settings[contact_message][feedback][settings][language][language_alterable]'] = TRUE; - $this->drupalGet($settings_path); - $this->submitForm($edit, 'Save configuration'); + // Enable language select. + $config = ContentLanguageSettings::loadByEntityTypeBundle('contact_message', 'feedback'); + $config->setDefaultLangcode(LanguageInterface::LANGCODE_SITE_DEFAULT); + $config->setLanguageAlterable(TRUE); + $config->save(); // Ensure that contact form now shows the language select. $this->drupalGet('contact'); -- GitLab