public function LingotekSystemSiteBulkTranslationTest::testRequestTranslationWithActionWithADocumentNotFoundError in Lingotek Translation 4.0.x
Same name and namespace in other branches
- 3.7.x tests/src/Functional/LingotekSystemSiteBulkTranslationTest.php \Drupal\Tests\lingotek\Functional\LingotekSystemSiteBulkTranslationTest::testRequestTranslationWithActionWithADocumentNotFoundError()
- 3.8.x tests/src/Functional/LingotekSystemSiteBulkTranslationTest.php \Drupal\Tests\lingotek\Functional\LingotekSystemSiteBulkTranslationTest::testRequestTranslationWithActionWithADocumentNotFoundError()
Tests that we manage errors when using the request translation action.
File
- tests/
src/ Functional/ LingotekSystemSiteBulkTranslationTest.php, line 1877
Class
- LingotekSystemSiteBulkTranslationTest
- Tests translating a config object using the bulk management form.
Namespace
Drupal\Tests\lingotek\FunctionalCode
public function testRequestTranslationWithActionWithADocumentNotFoundError() {
\Drupal::state()
->set('lingotek.must_document_not_found_error_in_request_translation', TRUE);
$this
->goToConfigBulkManagementForm();
// I can init the upload of content.
$this
->assertLingotekUploadLink();
$key = $this
->getBulkSelectionKey('en', 1);
$edit = [
$key => TRUE,
$this
->getBulkOperationFormName() => $this
->getBulkOperationNameForUpload('config'),
];
$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);
$edit = [
$key => TRUE,
$this
->getBulkOperationFormName() => $this
->getBulkOperationNameForRequestTranslation('es', 'node'),
];
$this
->drupalPostForm(NULL, $edit, $this
->getApplyActionsButtonLabel());
// Check the right class is added.
// We cannot use assertSourceStatus() as there are 4 elements by default with that status.
$this
->assertSourceStatusStateCount(Lingotek::STATUS_UNTRACKED, 'EN', 4);
$this
->assertNoLingotekRequestTranslationLink('es_MX');
$this
->assertText('Document System information was not found. Please upload again.');
}