function LanguageUILanguageNegotiationTest::testContentCustomization

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

Tests persistence of negotiation settings for the content language type.

File

core/modules/language/tests/src/Functional/LanguageUILanguageNegotiationTest.php, line 580

Class

LanguageUILanguageNegotiationTest
Tests the language UI for language switching.

Namespace

Drupal\Tests\language\Functional

Code

public function testContentCustomization() : void {
    // Customize content language settings from their defaults.
    $edit = [
        'language_content[configurable]' => TRUE,
        'language_content[enabled][language-url]' => FALSE,
        'language_content[enabled][language-session]' => TRUE,
    ];
    $this->drupalGet('admin/config/regional/language/detection');
    $this->submitForm($edit, 'Save settings');
    // Check if configurability persisted.
    $config = $this->config('language.types');
    $this->assertContains('language_interface', $config->get('configurable'), 'Interface language is configurable.');
    $this->assertContains('language_content', $config->get('configurable'), 'Content language is configurable.');
    // Ensure configuration was saved.
    $this->assertArrayNotHasKey('language-url', $config->get('negotiation.language_content.enabled'));
    $this->assertArrayHasKey('language-session', $config->get('negotiation.language_content.enabled'));
}

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