You are here

public function LanguageFormTest::testEnablingCustomLanguage in Lingotek Translation 3.3.x

Same name and namespace in other branches
  1. 8.2 tests/src/Functional/Form/LanguageFormTest.php \Drupal\Tests\lingotek\Functional\Form\LanguageFormTest::testEnablingCustomLanguage()
  2. 4.0.x tests/src/Functional/Form/LanguageFormTest.php \Drupal\Tests\lingotek\Functional\Form\LanguageFormTest::testEnablingCustomLanguage()
  3. 3.0.x tests/src/Functional/Form/LanguageFormTest.php \Drupal\Tests\lingotek\Functional\Form\LanguageFormTest::testEnablingCustomLanguage()
  4. 3.1.x tests/src/Functional/Form/LanguageFormTest.php \Drupal\Tests\lingotek\Functional\Form\LanguageFormTest::testEnablingCustomLanguage()
  5. 3.2.x tests/src/Functional/Form/LanguageFormTest.php \Drupal\Tests\lingotek\Functional\Form\LanguageFormTest::testEnablingCustomLanguage()
  6. 3.4.x tests/src/Functional/Form/LanguageFormTest.php \Drupal\Tests\lingotek\Functional\Form\LanguageFormTest::testEnablingCustomLanguage()
  7. 3.5.x tests/src/Functional/Form/LanguageFormTest.php \Drupal\Tests\lingotek\Functional\Form\LanguageFormTest::testEnablingCustomLanguage()
  8. 3.6.x tests/src/Functional/Form/LanguageFormTest.php \Drupal\Tests\lingotek\Functional\Form\LanguageFormTest::testEnablingCustomLanguage()
  9. 3.7.x tests/src/Functional/Form/LanguageFormTest.php \Drupal\Tests\lingotek\Functional\Form\LanguageFormTest::testEnablingCustomLanguage()
  10. 3.8.x tests/src/Functional/Form/LanguageFormTest.php \Drupal\Tests\lingotek\Functional\Form\LanguageFormTest::testEnablingCustomLanguage()

Tests enabling for Lingotek a custom language that was disabled.

File

tests/src/Functional/Form/LanguageFormTest.php, line 162

Class

LanguageFormTest
Test the Drupal language form alters.

Namespace

Drupal\Tests\lingotek\Functional\Form

Code

public function testEnablingCustomLanguage() {
  ConfigurableLanguage::create([
    'id' => 'de-at',
    'label' => 'German (AT)',
  ])
    ->setThirdPartySetting('lingotek', 'disabled', TRUE)
    ->save();

  // Check that there is a select for locales.
  $this
    ->drupalGet('/admin/config/regional/language');

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

  // The Lingotek locale is enabled by default.
  $this
    ->getSession()
    ->getPage()
    ->hasCheckedField('lingotek_disabled');
  $edit = [
    'lingotek_disabled' => FALSE,
  ];
  $this
    ->drupalPostForm(NULL, $edit, 'Save language');

  // Ensure the language is disabled.
  $language = ConfigurableLanguage::load('de-at');
  $this
    ->assertFalse($language
    ->getThirdPartySetting('lingotek', 'disabled'), 'The Lingotek locale has been enabled successfully.');

  // Check that there is a select for locales.
  $this
    ->drupalGet('/admin/config/regional/language');

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