You are here

public function TMGMTUiTest::testSettings in Translation Management Tool 8

Test the settings of TMGMT.

@todo some settings have no test coverage in their effect. @todo we will need to switch them in context of the other lifecycle tests.

File

tests/src/Functional/TMGMTUiTest.php, line 820

Class

TMGMTUiTest
Verifies basic functionality of the user interface

Namespace

Drupal\Tests\tmgmt\Functional

Code

public function testSettings() {
  $this
    ->loginAsAdmin();
  $settings = \Drupal::config('tmgmt.settings');
  $this
    ->assertTrue($settings
    ->get('quick_checkout'));
  $this
    ->assertTrue($settings
    ->get('anonymous_access'));
  $this
    ->assertEqual('_never', $settings
    ->get('purge_finished'));
  $this
    ->assertTrue($settings
    ->get('word_count_exclude_tags'));
  $this
    ->assertEqual(20, $settings
    ->get('source_list_limit'));
  $this
    ->assertEqual(50, $settings
    ->get('job_items_cron_limit'));
  $this
    ->assertTrue($settings
    ->get('respect_text_format'));
  $this
    ->assertFalse($settings
    ->get('submit_job_item_on_cron'));
  $this
    ->drupalGet('admin/tmgmt/settings');
  $edit = [
    'tmgmt_quick_checkout' => FALSE,
    'tmgmt_anonymous_access' => FALSE,
    'tmgmt_purge_finished' => 0,
    'respect_text_format' => FALSE,
    'tmgmt_submit_job_item_on_cron' => TRUE,
  ];
  $this
    ->drupalPostForm(NULL, $edit, t('Save configuration'));
  $settings = \Drupal::config('tmgmt.settings');
  $this
    ->assertFalse($settings
    ->get('quick_checkout'));
  $this
    ->assertFalse($settings
    ->get('anonymous_access'));
  $this
    ->assertEqual(0, $settings
    ->get('purge_finished'));
  $this
    ->assertFalse($settings
    ->get('respect_text_format'));
  $this
    ->assertTrue($settings
    ->get('submit_job_item_on_cron'));
}