public function LanguageFormTest::testEditingCustomLanguage in Lingotek Translation 8
Tests editing a custom language with a custom locale.
File
- src/
Tests/ Form/ LanguageFormTest.php, line 103
Class
- LanguageFormTest
- Test the Drupal language form alters.
Namespace
Drupal\lingotek\Tests\FormCode
public function testEditingCustomLanguage() {
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-DE',
];
$this
->drupalPostForm(NULL, $edit, 'Save language');
// Click again on edit for German (AT).
$this
->clickLink('Edit', 1);
// Assert that the locale is correct.
$this
->assertFieldByName('lingotek_locale', 'de-DE', 'The Lingotek locale is set to the right language after editing.');
}