public function LingotekNodeBulkTranslationTest::testDownloadTranslationWithActionWithADocumentNotFoundError in Lingotek Translation 3.7.x
Same name and namespace in other branches
- 4.0.x tests/src/Functional/LingotekNodeBulkTranslationTest.php \Drupal\Tests\lingotek\Functional\LingotekNodeBulkTranslationTest::testDownloadTranslationWithActionWithADocumentNotFoundError()
- 3.8.x tests/src/Functional/LingotekNodeBulkTranslationTest.php \Drupal\Tests\lingotek\Functional\LingotekNodeBulkTranslationTest::testDownloadTranslationWithActionWithADocumentNotFoundError()
Tests that we manage errors when using the download translation action.
File
- tests/
src/ Functional/ LingotekNodeBulkTranslationTest.php, line 3005
Class
- LingotekNodeBulkTranslationTest
- Tests translating a node using the bulk management form.
Namespace
Drupal\Tests\lingotek\FunctionalCode
public function testDownloadTranslationWithActionWithADocumentNotFoundError() {
\Drupal::state()
->set('lingotek.must_document_not_found_error_download', TRUE);
// Create a node.
$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);
$this
->goToContentBulkManagementForm();
// I can init the upload of content.
$this
->assertLingotekUploadLink();
$key = $this
->getBulkSelectionKey('en', 1);
$edit = [
$key => TRUE,
$this
->getBulkOperationFormName() => $this
->getBulkOperationNameForUpload('node'),
];
$this
->drupalPostForm(NULL, $edit, $this
->getApplyActionsButtonLabel());
$this
->assertIdentical('en_US', \Drupal::state()
->get('lingotek.uploaded_locale'));
// I can check current status.
$this
->assertLingotekCheckSourceStatusLink();
// I can request a translation
$this
->assertLingotekRequestTranslationLink('es_MX');
$this
->assertTargetStatus('ES', Lingotek::STATUS_REQUEST);
// Request the translation.
$this
->clickLink('ES');
$this
->assertTargetStatus('ES', Lingotek::STATUS_PENDING);
// Check the status of the translation.
$this
->clickLink('ES');
$this
->assertTargetStatus('ES', Lingotek::STATUS_READY);
// Download translation.
$edit = [
$key => TRUE,
$this
->getBulkOperationFormName() => $this
->getBulkOperationNameForDownloadTranslation('es', 'node'),
];
$this
->drupalPostForm(NULL, $edit, $this
->getApplyActionsButtonLabel());
$this
->assertSourceStatus('EN', Lingotek::STATUS_UNTRACKED);
$this
->assertNoLingotekRequestTranslationLink('es_MX');
$this
->assertText('Document node Llamas are cool was not found. Please upload again.');
}