You are here

public function JobsTest::testAddToJobDueDateValidationInvalidDate in TMGMT Translator Smartling 8.3

Same name and namespace in other branches
  1. 8.4 tests/src/Functional/JobsTest.php \Drupal\Tests\tmgmt_smartling\Functional\JobsTest::testAddToJobDueDateValidationInvalidDate()

Add to job form: due date validation (invalid date).

File

tests/src/Functional/JobsTest.php, line 373

Class

JobsTest
Jobs tests.

Namespace

Drupal\Tests\tmgmt_smartling\Functional

Code

public function testAddToJobDueDateValidationInvalidDate() {
  if (!empty($this->smartlingPluginProviderSettings)) {
    $this
      ->drupalPostForm('/admin/tmgmt/sources', [
      'items[1]' => 1,
    ], t('Request translation'));
    $this
      ->drupalPostForm(NULL, [
      'target_language' => 'de',
      'settings[switcher]' => TMGMT_SMARTLING_ADD_TO_JOB,
      'settings[add_to_job_tab][container][job_info][due_date][date]' => '2012-12-12',
      'settings[add_to_job_tab][container][job_info][due_date][time]' => '',
      'settings[add_to_job_tab][container][job_info][authorize]' => TRUE,
      'settings[smartling_users_time_zone]' => 'Europe/Kiev',
    ], t('Submit to provider'));
    $this
      ->assertText(t('Please enter a date in the format'));
    $this
      ->assertNoText(t('Due date can not be in the past.'));
    $this
      ->drupalPostForm('/admin/tmgmt/sources', [
      'items[1]' => 1,
    ], t('Request translation'));
    $this
      ->drupalPostForm(NULL, [
      'target_language' => 'de',
      'settings[switcher]' => TMGMT_SMARTLING_ADD_TO_JOB,
      'settings[add_to_job_tab][container][job_info][due_date][date]' => '',
      'settings[add_to_job_tab][container][job_info][due_date][time]' => '12:12',
      'settings[add_to_job_tab][container][job_info][authorize]' => TRUE,
      'settings[smartling_users_time_zone]' => 'Europe/Kiev',
    ], t('Submit to provider'));
    $this
      ->assertText(t('Please enter a date in the format'));
    $this
      ->assertNoText(t('Due date can not be in the past.'));
  }
  else {
    $this
      ->fail("Smartling settings file for simpletests not found.");
  }
}