You are here

public function LanguageUILanguageNegotiationTest::testContentCustomization in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/language/src/Tests/LanguageUILanguageNegotiationTest.php \Drupal\language\Tests\LanguageUILanguageNegotiationTest::testContentCustomization()

Tests persistence of negotiation settings for the content language type.

File

core/modules/language/src/Tests/LanguageUILanguageNegotiationTest.php, line 497
Contains \Drupal\language\Tests\LanguageUILanguageNegotiationTest.

Class

LanguageUILanguageNegotiationTest
Tests the language UI for language switching.

Namespace

Drupal\language\Tests

Code

public function testContentCustomization() {

  // Customize content language settings from their defaults.
  $edit = array(
    'language_content[configurable]' => TRUE,
    'language_content[enabled][language-url]' => FALSE,
    'language_content[enabled][language-session]' => TRUE,
  );
  $this
    ->drupalPostForm('admin/config/regional/language/detection', $edit, t('Save settings'));

  // Check if configurability persisted.
  $config = $this
    ->config('language.types');
  $this
    ->assertTrue(in_array('language_interface', $config
    ->get('configurable')), 'Interface language is configurable.');
  $this
    ->assertTrue(in_array('language_content', $config
    ->get('configurable')), 'Content language is configurable.');

  // Ensure configuration was saved.
  $this
    ->assertFalse(array_key_exists('language-url', $config
    ->get('negotiation.language_content.enabled')), 'URL negotiation is not enabled for content.');
  $this
    ->assertTrue(array_key_exists('language-session', $config
    ->get('negotiation.language_content.enabled')), 'Session negotiation is enabled for content.');
}