public function LingotekConfigBulkFormTest::testClearJobIdsWithTMSUpdateWithADocumentLockedError in Lingotek Translation 3.0.x
Same name and namespace in other branches
- 8.2 tests/src/Functional/Form/LingotekConfigBulkFormTest.php \Drupal\Tests\lingotek\Functional\Form\LingotekConfigBulkFormTest::testClearJobIdsWithTMSUpdateWithADocumentLockedError()
- 4.0.x tests/src/Functional/Form/LingotekConfigBulkFormTest.php \Drupal\Tests\lingotek\Functional\Form\LingotekConfigBulkFormTest::testClearJobIdsWithTMSUpdateWithADocumentLockedError()
- 3.1.x tests/src/Functional/Form/LingotekConfigBulkFormTest.php \Drupal\Tests\lingotek\Functional\Form\LingotekConfigBulkFormTest::testClearJobIdsWithTMSUpdateWithADocumentLockedError()
- 3.2.x tests/src/Functional/Form/LingotekConfigBulkFormTest.php \Drupal\Tests\lingotek\Functional\Form\LingotekConfigBulkFormTest::testClearJobIdsWithTMSUpdateWithADocumentLockedError()
- 3.3.x tests/src/Functional/Form/LingotekConfigBulkFormTest.php \Drupal\Tests\lingotek\Functional\Form\LingotekConfigBulkFormTest::testClearJobIdsWithTMSUpdateWithADocumentLockedError()
- 3.4.x tests/src/Functional/Form/LingotekConfigBulkFormTest.php \Drupal\Tests\lingotek\Functional\Form\LingotekConfigBulkFormTest::testClearJobIdsWithTMSUpdateWithADocumentLockedError()
- 3.5.x tests/src/Functional/Form/LingotekConfigBulkFormTest.php \Drupal\Tests\lingotek\Functional\Form\LingotekConfigBulkFormTest::testClearJobIdsWithTMSUpdateWithADocumentLockedError()
- 3.6.x tests/src/Functional/Form/LingotekConfigBulkFormTest.php \Drupal\Tests\lingotek\Functional\Form\LingotekConfigBulkFormTest::testClearJobIdsWithTMSUpdateWithADocumentLockedError()
- 3.7.x tests/src/Functional/Form/LingotekConfigBulkFormTest.php \Drupal\Tests\lingotek\Functional\Form\LingotekConfigBulkFormTest::testClearJobIdsWithTMSUpdateWithADocumentLockedError()
- 3.8.x tests/src/Functional/Form/LingotekConfigBulkFormTest.php \Drupal\Tests\lingotek\Functional\Form\LingotekConfigBulkFormTest::testClearJobIdsWithTMSUpdateWithADocumentLockedError()
Tests clearing job ids with TMS update.
File
- tests/
src/ Functional/ Form/ LingotekConfigBulkFormTest.php, line 1001
Class
- LingotekConfigBulkFormTest
- Tests the config bulk management form.
Namespace
Drupal\Tests\lingotek\Functional\FormCode
public function testClearJobIdsWithTMSUpdateWithADocumentLockedError() {
$assert_session = $this
->assertSession();
$this
->goToConfigBulkManagementForm('node_type');
$basepath = \Drupal::request()
->getBasePath();
// I can init the upload of content.
$assert_session
->linkByHrefExists($basepath . '/admin/lingotek/config/upload/node_type/article?destination=' . $basepath . '/admin/lingotek/config/manage');
$assert_session
->linkByHrefExists($basepath . '/admin/lingotek/config/upload/node_type/page?destination=' . $basepath . '/admin/lingotek/config/manage');
$this
->clickLink('EN');
$edit = [
'table[article]' => TRUE,
$this
->getBulkOperationFormName() => $this
->getBulkOperationNameForAssignJobId('node_type'),
];
$this
->drupalPostForm(NULL, $edit, $this
->getApplyActionsButtonLabel());
$edit = [
'job_id' => 'my_custom_job_id_1',
'update_tms' => 1,
];
$this
->drupalPostForm(NULL, $edit, 'Assign Job ID');
$this
->assertText('Job ID was assigned successfully.');
$edit = [
'table[page]' => TRUE,
$this
->getBulkOperationFormName() => $this
->getBulkOperationNameForAssignJobId('node_type'),
];
$this
->drupalPostForm(NULL, $edit, $this
->getApplyActionsButtonLabel());
$edit = [
'job_id' => 'my_custom_job_id_2',
'update_tms' => 1,
];
$this
->drupalPostForm(NULL, $edit, 'Assign Job ID');
$this
->assertText('Job ID was assigned successfully.');
// The job id is displayed.
$this
->assertText('my_custom_job_id_1');
$this
->assertText('my_custom_job_id_2');
// If we update the job ID with notification to the TMS, an update happens.
\Drupal::state()
->set('lingotek.must_document_locked_error_in_update', TRUE);
$edit = [
'table[article]' => TRUE,
'table[page]' => TRUE,
$this
->getBulkOperationFormName() => $this
->getBulkOperationNameForClearJobId('node_type'),
];
$this
->drupalPostForm(NULL, $edit, $this
->getApplyActionsButtonLabel());
$this
->drupalPostForm(NULL, [
'update_tms' => 1,
], 'Clear Job ID');
$this
->assertText('Document node_type Article has a new version. The document id has been updated for all future interactions. Please try again.');
$this
->assertText('Job ID for some config failed to sync to the TMS.');
// There is an update with empty job id.
\Drupal::state()
->resetCache();
$this
->assertEquals('my_custom_job_id_1', \Drupal::state()
->get('lingotek.uploaded_job_id'));
// The job id is gone.
$this
->assertText('my_custom_job_id_1');
$this
->assertNoText('my_custom_job_id_2');
}