You are here

public function LanguageFormTest::testAddingLanguage in Lingotek Translation 8

Tests adding a defined language has the right locale.

File

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

Class

LanguageFormTest
Test the Drupal language form alters.

Namespace

Drupal\lingotek\Tests\Form

Code

public function testAddingLanguage() {

  // Enable import of translations. By default this is disabled for automated
  // tests.
  $this
    ->config('locale.settings')
    ->set('translation.import_enabled', TRUE)
    ->save();
  $this
    ->drupalGet('admin/config/regional/language/add');
  $edit = [
    'predefined_langcode' => 'de',
  ];
  $this
    ->drupalPostForm(NULL, $edit, 'Add language');

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

  // Assert that the locale is correct.
  $this
    ->assertFieldByName('lingotek_locale', 'de-DE', 'The Lingotek locale is set correctly.');
}