You are here

public function LanguageFormTest::testEditingCustomLanguageWithWrongLocale in Lingotek Translation 8

Tests editing a custom language with a custom locale.

File

src/Tests/Form/LanguageFormTest.php, line 126

Class

LanguageFormTest
Test the Drupal language form alters.

Namespace

Drupal\lingotek\Tests\Form

Code

public function testEditingCustomLanguageWithWrongLocale() {
  ConfigurableLanguage::create([
    'id' => 'de-at',
    'label' => 'German (AT)',
  ])
    ->save();
  $this
    ->drupalGet('/admin/config/regional/language');

  // Click on edit for German (AT).
  $this
    ->clickLink('Edit', 1);

  // Assert that the locale is correct.
  $this
    ->assertFieldByName('lingotek_locale', 'de-AT', 'The Lingotek locale is set to the right language.');

  // Edit the locale.
  $edit = [
    'lingotek_locale' => 'de-IN',
  ];
  $this
    ->drupalPostForm(NULL, $edit, 'Save language');
  $this
    ->assertText('The Lingotek locale de-IN does not exist.');
}