public function TMGMTUiTest::testSettings

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 824

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
    ->assertEquals('_never', $settings
    ->get('purge_finished'));
  $this
    ->assertTrue($settings
    ->get('word_count_exclude_tags'));
  $this
    ->assertEquals(20, $settings
    ->get('source_list_limit'));
  $this
    ->assertEquals(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
    ->submitForm($edit, 'Save configuration');
  $settings = \Drupal::config('tmgmt.settings');
  $this
    ->assertFalse($settings
    ->get('quick_checkout'));
  $this
    ->assertFalse($settings
    ->get('anonymous_access'));
  $this
    ->assertEquals(0, $settings
    ->get('purge_finished'));
  $this
    ->assertFalse($settings
    ->get('respect_text_format'));
  $this
    ->assertTrue($settings
    ->get('submit_job_item_on_cron'));
}