public function JobsTest::testCreateJobExistingNameValidation in TMGMT Translator Smartling 8.3
Same name and namespace in other branches
- 8.4 tests/src/Functional/JobsTest.php \Drupal\Tests\tmgmt_smartling\Functional\JobsTest::testCreateJobExistingNameValidation()
Create job form: existing name validation.
File
- tests/
src/ Functional/ JobsTest.php, line 237
Class
- JobsTest
- Jobs tests.
Namespace
Drupal\Tests\tmgmt_smartling\FunctionalCode
public function testCreateJobExistingNameValidation() {
if (!empty($this->smartlingPluginProviderSettings)) {
$existing_job_name = 'Drupal TMGMT connector test: EXISTING JOB';
$this
->drupalPostForm('/admin/tmgmt/sources', [
'items[1]' => 1,
], t('Request translation'));
$this
->drupalPostForm(NULL, [
'target_language' => 'de',
'settings[create_new_job_tab][name]' => $existing_job_name,
'settings[create_new_job_tab][due_date][date]' => '2020-12-12',
'settings[create_new_job_tab][due_date][time]' => '12:12',
'settings[create_new_job_tab][authorize]' => TRUE,
'settings[smartling_users_time_zone]' => 'Europe/Kiev',
], t('Submit to provider'));
$this
->drupalPostForm('/admin/tmgmt/sources', [
'items[1]' => 1,
], t('Request translation'));
$this
->drupalPostForm(NULL, [
'target_language' => 'de',
'settings[create_new_job_tab][name]' => $existing_job_name,
'settings[create_new_job_tab][due_date][date]' => '2020-12-12',
'settings[create_new_job_tab][due_date][time]' => '12:12',
'settings[create_new_job_tab][authorize]' => TRUE,
'settings[smartling_users_time_zone]' => 'Europe/Kiev',
], t('Submit to provider'));
$this
->assertText(t('Job with name "@name" already exists. Please choose another job name.', [
'@name' => $existing_job_name,
]));
}
else {
$this
->fail("Smartling settings file for simpletests not found.");
}
}