public function LingotekNodeBulkFormTest::testClearJobIdsWithTMSUpdateWithADocumentArchivedError in Lingotek Translation 3.2.x
Same name and namespace in other branches
- 8.2 tests/src/Functional/Form/LingotekNodeBulkFormTest.php \Drupal\Tests\lingotek\Functional\Form\LingotekNodeBulkFormTest::testClearJobIdsWithTMSUpdateWithADocumentArchivedError()
- 4.0.x tests/src/Functional/Form/LingotekNodeBulkFormTest.php \Drupal\Tests\lingotek\Functional\Form\LingotekNodeBulkFormTest::testClearJobIdsWithTMSUpdateWithADocumentArchivedError()
- 3.0.x tests/src/Functional/Form/LingotekNodeBulkFormTest.php \Drupal\Tests\lingotek\Functional\Form\LingotekNodeBulkFormTest::testClearJobIdsWithTMSUpdateWithADocumentArchivedError()
- 3.1.x tests/src/Functional/Form/LingotekNodeBulkFormTest.php \Drupal\Tests\lingotek\Functional\Form\LingotekNodeBulkFormTest::testClearJobIdsWithTMSUpdateWithADocumentArchivedError()
- 3.3.x tests/src/Functional/Form/LingotekNodeBulkFormTest.php \Drupal\Tests\lingotek\Functional\Form\LingotekNodeBulkFormTest::testClearJobIdsWithTMSUpdateWithADocumentArchivedError()
- 3.4.x tests/src/Functional/Form/LingotekNodeBulkFormTest.php \Drupal\Tests\lingotek\Functional\Form\LingotekNodeBulkFormTest::testClearJobIdsWithTMSUpdateWithADocumentArchivedError()
- 3.5.x tests/src/Functional/Form/LingotekNodeBulkFormTest.php \Drupal\Tests\lingotek\Functional\Form\LingotekNodeBulkFormTest::testClearJobIdsWithTMSUpdateWithADocumentArchivedError()
- 3.6.x tests/src/Functional/Form/LingotekNodeBulkFormTest.php \Drupal\Tests\lingotek\Functional\Form\LingotekNodeBulkFormTest::testClearJobIdsWithTMSUpdateWithADocumentArchivedError()
- 3.7.x tests/src/Functional/Form/LingotekNodeBulkFormTest.php \Drupal\Tests\lingotek\Functional\Form\LingotekNodeBulkFormTest::testClearJobIdsWithTMSUpdateWithADocumentArchivedError()
- 3.8.x tests/src/Functional/Form/LingotekNodeBulkFormTest.php \Drupal\Tests\lingotek\Functional\Form\LingotekNodeBulkFormTest::testClearJobIdsWithTMSUpdateWithADocumentArchivedError()
Tests clearing job ids with TMS update.
File
- tests/
src/ Functional/ Form/ LingotekNodeBulkFormTest.php, line 1792
Class
- LingotekNodeBulkFormTest
- Tests the bulk management form.
Namespace
Drupal\Tests\lingotek\Functional\FormCode
public function testClearJobIdsWithTMSUpdateWithADocumentArchivedError() {
$assert_session = $this
->assertSession();
// Create a couple of nodes.
$edit = [];
$edit['title[0][value]'] = 'Llamas are cool';
$edit['body[0][value]'] = 'Llamas are very cool';
$edit['langcode[0][value]'] = 'en';
$edit['lingotek_translation_management[lingotek_translation_profile]'] = 'manual';
$this
->saveAndPublishNodeForm($edit);
$edit['title[0][value]'] = 'Dogs are cool';
$edit['body[0][value]'] = 'Dogs are very cool';
$edit['langcode[0][value]'] = 'en';
$edit['lingotek_translation_management[lingotek_translation_profile]'] = 'manual';
$this
->saveAndPublishNodeForm($edit);
$this
->goToContentBulkManagementForm();
// I can init the upload of content.
$this
->assertLingotekUploadLink(1);
$this
->assertLingotekUploadLink(2);
$this
->clickLink('EN');
$edit = [
'table[1]' => TRUE,
$this
->getBulkOperationFormName() => $this
->getBulkOperationNameForAssignJobId('node'),
];
$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[2]' => TRUE,
$this
->getBulkOperationFormName() => $this
->getBulkOperationNameForAssignJobId('node'),
];
$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.');
// If we update the job ID with notification to the TMS, an update happens.
\Drupal::state()
->set('lingotek.must_document_archived_error_in_update', TRUE);
// The job id is displayed.
$this
->assertText('my_custom_job_id_1');
$this
->assertText('my_custom_job_id_2');
$edit = [
'table[1]' => TRUE,
'table[2]' => TRUE,
$this
->getBulkOperationFormName() => $this
->getBulkOperationNameForClearJobId('node'),
];
$this
->drupalPostForm(NULL, $edit, $this
->getApplyActionsButtonLabel());
$this
->drupalPostForm(NULL, [
'update_tms' => 1,
], 'Clear Job ID');
$this
->assertText('Document node Llamas are cool has been archived. Please upload again.');
$this
->assertText('Job ID for some content 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');
}