You are here

public function LingotekSettingsTabConfigurationFormTest::testConfigurationForm in Lingotek Translation 3.4.x

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

Test that if there are no entities, there is a proper feedback to the user.

File

tests/src/Functional/Form/LingotekSettingsTabConfigurationFormTest.php, line 17

Class

LingotekSettingsTabConfigurationFormTest
Tests the Lingotek configuration settings form.

Namespace

Drupal\Tests\lingotek\Functional\Form

Code

public function testConfigurationForm() {
  $this
    ->drupalGet('admin/lingotek/settings');

  // Nothing is selected.
  $this
    ->assertNoFieldChecked('edit-table-configurable-language-enabled');

  // Check the configurable language and set the manual profile.
  $edit = [
    'table[configurable_language][enabled]' => 1,
    'table[configurable_language][profile]' => 'manual',
  ];
  $this
    ->drupalPostForm(NULL, $edit, 'Save', [], 'lingoteksettings-tab-configuration-form');

  // The values shown are correct.
  $this
    ->assertFieldChecked('edit-table-configurable-language-enabled');
  $this
    ->assertFieldByName('table[configurable_language][profile]', 'manual');

  /** @var \Drupal\lingotek\LingotekConfigTranslationServiceInterface $config_translation */
  $config_translation = \Drupal::service('lingotek.config_translation');

  /** @var \Drupal\lingotek\LingotekConfigurationServiceInterface $lingotek_config */
  $lingotek_config = \Drupal::service('lingotek.configuration');
  $this
    ->assertTrue($config_translation
    ->isEnabled('configurable_language'));
  $this
    ->assertEqual('manual', $lingotek_config
    ->getConfigEntityDefaultProfileId('configurable_language'));
  $this
    ->assertEqual([
    'configurable_language',
  ], $config_translation
    ->getEnabledConfigTypes());
}