You are here

public function LanguageNegotiationInfoTest::testConfigLangTypeAlterations in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/language/tests/src/Functional/LanguageNegotiationInfoTest.php \Drupal\Tests\language\Functional\LanguageNegotiationInfoTest::testConfigLangTypeAlterations()
  2. 10 core/modules/language/tests/src/Functional/LanguageNegotiationInfoTest.php \Drupal\Tests\language\Functional\LanguageNegotiationInfoTest::testConfigLangTypeAlterations()

Tests altering config of configurable language types.

File

core/modules/language/tests/src/Functional/LanguageNegotiationInfoTest.php, line 186

Class

LanguageNegotiationInfoTest
Tests alterations to language types/negotiation info.

Namespace

Drupal\Tests\language\Functional

Code

public function testConfigLangTypeAlterations() {

  // Default of config.
  $test_type = LanguageInterface::TYPE_CONTENT;
  $this
    ->assertFalse($this
    ->isLanguageTypeConfigurable($test_type), 'Language type is not configurable.');

  // Editing config.
  $edit = [
    $test_type . '[configurable]' => TRUE,
  ];
  $this
    ->drupalGet('admin/config/regional/language/detection');
  $this
    ->submitForm($edit, 'Save settings');
  $this
    ->assertTrue($this
    ->isLanguageTypeConfigurable($test_type), 'Language type is now configurable.');

  // After installing another module, the config should be the same.
  $this
    ->drupalGet('admin/modules');
  $this
    ->submitForm([
    'modules[test_module][enable]' => 1,
  ], 'Install');
  $this
    ->assertTrue($this
    ->isLanguageTypeConfigurable($test_type), 'Language type is still configurable.');

  // After uninstalling the other module, the config should be the same.
  $this
    ->drupalGet('admin/modules/uninstall');
  $this
    ->submitForm([
    'uninstall[test_module]' => 1,
  ], 'Uninstall');
  $this
    ->assertTrue($this
    ->isLanguageTypeConfigurable($test_type), 'Language type is still configurable.');
}