Skip to content
Snippets Groups Projects
Verified Commit 7a5cfb3c authored by Théodore Biadala's avatar Théodore Biadala
Browse files

Issue #3385838 by pooja_sharma, longwave, joachim, smustgrave:...

Issue #3385838 by pooja_sharma, longwave, joachim, smustgrave: PathLanguageTest should use API to set up language

(cherry picked from commit be281b5f)
parent a5186f55
Branches
Tags
17 merge requests!10663Issue #3495778: Update phpdoc in FileSaveHtaccessLoggingTest,!10451Issue #3472458 by watergate, smustgrave: CKEditor 5 show blocks label is not translated,!103032838547 Fix punctuation rules for inline label suffix colon with CSS only,!10150Issue #3467294 by quietone, nod_, smustgrave, catch, longwave: Change string...,!10130Resolve #3480321 "Second level menu",!9936Issue #3483087: Check the module:// prefix in the translation server path and replace it with the actual module path,!9933Issue #3394728 by ankondrat4: Undefined array key "#prefix" and deprecated function: explode() in Drupal\file\Element\ManagedFile::uploadAjaxCallback(),!9914Issue #3451136 by quietone, gapple, ghost of drupal past: Improve...,!9882Draft: Issue #3481777 In bulk_form ensure the triggering element is the bulk_form button,!9839Issue #3445469 by pooja_sharma, smustgrave: Add additional test coverage for...,!9815Issue #3480025: There is no way to remove entity cache items,!9757Issue #3478869 Add "All" or overview links to parent links,!9752Issue #3439910 by pooja_sharma, vensires: Fix Toolbar tests that rely on UID1's super user behavior,!9749Issue #3439910 by pooja_sharma, vensires: Fix Toolbar tests that rely on UID1's super user behavior,!9678Issue #3465132 by catch, Spokje, nod_: Show test run time by class in run-tests.sh output,!9578Issue #3304746 by scott_euser, casey, smustgrave: BigPipe cannot handle (GET)...,!9449Issue #3344041: Allow textarea widgets to be used for text (formatted) fields
Pipeline #265873 passed with warnings
Pipeline: drupal

#265879

    ...@@ -4,6 +4,10 @@ ...@@ -4,6 +4,10 @@
    namespace Drupal\Tests\path\Functional; namespace Drupal\Tests\path\Functional;
    use Drupal\Core\Language\LanguageInterface;
    use Drupal\language\Plugin\LanguageNegotiation\LanguageNegotiationUrl;
    use Drupal\user\Entity\User;
    use Drupal\user\Plugin\LanguageNegotiation\LanguageNegotiationUser;
    use Drupal\Tests\content_translation\Traits\ContentTranslationTestTrait; use Drupal\Tests\content_translation\Traits\ContentTranslationTestTrait;
    /** /**
    ...@@ -65,9 +69,7 @@ protected function setUp(): void { ...@@ -65,9 +69,7 @@ protected function setUp(): void {
    static::createLanguageFromLangcode('fr'); static::createLanguageFromLangcode('fr');
    // Enable URL language detection and selection. // Enable URL language detection and selection.
    $edit = ['language_interface[enabled][language-url]' => 1]; $this->container->get('language_negotiator')->saveConfiguration(LanguageInterface::TYPE_URL, [LanguageNegotiationUrl::METHOD_ID => 1]);
    $this->drupalGet('admin/config/regional/language/detection');
    $this->submitForm($edit, 'Save settings');
    // Enable translation for page node. // Enable translation for page node.
    static::enableContentTranslation('node', 'page'); static::enableContentTranslation('node', 'page');
    ...@@ -135,19 +137,13 @@ public function testAliasTranslation(): void { ...@@ -135,19 +137,13 @@ public function testAliasTranslation(): void {
    // Confirm that the alias works even when changing language negotiation // Confirm that the alias works even when changing language negotiation
    // options. Enable User language detection and selection over URL one. // options. Enable User language detection and selection over URL one.
    $edit = [ $this->container->get('language_negotiator')->saveConfiguration(LanguageInterface::TYPE_INTERFACE, [LanguageNegotiationUser::METHOD_ID => 1]);
    'language_interface[enabled][language-user]' => 1, $this->container->get('language_negotiator')->saveConfiguration(LanguageInterface::TYPE_URL, [LanguageNegotiationUrl::METHOD_ID => 1]);
    'language_interface[weight][language-user]' => -9,
    'language_interface[enabled][language-url]' => 1,
    'language_interface[weight][language-url]' => -8,
    ];
    $this->drupalGet('admin/config/regional/language/detection');
    $this->submitForm($edit, 'Save settings');
    // Change user language preference. // Change user language preference.
    $edit = ['preferred_langcode' => 'fr']; $user = User::load($this->webUser->id());
    $this->drupalGet("user/" . $this->webUser->id() . "/edit"); $user->set('preferred_langcode', 'fr');
    $this->submitForm($edit, 'Save'); $user->save();
    // Check that the English alias works. In this situation French is the // Check that the English alias works. In this situation French is the
    // current UI and content language, while URL language is English (since we // current UI and content language, while URL language is English (since we
    ...@@ -165,9 +161,7 @@ public function testAliasTranslation(): void { ...@@ -165,9 +161,7 @@ public function testAliasTranslation(): void {
    $this->assertSession()->pageTextContains($english_node_french_translation->body->value); $this->assertSession()->pageTextContains($english_node_french_translation->body->value);
    // Disable URL language negotiation. // Disable URL language negotiation.
    $edit = ['language_interface[enabled][language-url]' => FALSE]; $this->container->get('language_negotiator')->saveConfiguration(LanguageInterface::TYPE_URL, [LanguageNegotiationUrl::METHOD_ID => FALSE]);
    $this->drupalGet('admin/config/regional/language/detection');
    $this->submitForm($edit, 'Save settings');
    // Check that the English alias still works. // Check that the English alias still works.
    $this->drupalGet($english_alias); $this->drupalGet($english_alias);
    ......
    0% Loading or .
    You are about to add 0 people to the discussion. Proceed with caution.
    Please register or to comment