You are here

public function LingotekSystemSiteBulkTranslationTest::testRequestAllTranslationsWithActionWithADocumentNotFoundError in Lingotek Translation 3.8.x

Same name and namespace in other branches
  1. 4.0.x tests/src/Functional/LingotekSystemSiteBulkTranslationTest.php \Drupal\Tests\lingotek\Functional\LingotekSystemSiteBulkTranslationTest::testRequestAllTranslationsWithActionWithADocumentNotFoundError()
  2. 3.7.x tests/src/Functional/LingotekSystemSiteBulkTranslationTest.php \Drupal\Tests\lingotek\Functional\LingotekSystemSiteBulkTranslationTest::testRequestAllTranslationsWithActionWithADocumentNotFoundError()

Tests that we manage errors when using the request all translations action.

File

tests/src/Functional/LingotekSystemSiteBulkTranslationTest.php, line 1525

Class

LingotekSystemSiteBulkTranslationTest
Tests translating a config object using the bulk management form.

Namespace

Drupal\Tests\lingotek\Functional

Code

public function testRequestAllTranslationsWithActionWithADocumentNotFoundError() {
  \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
      ->getBulkOperationNameForRequestTranslations('config'),
  ];
  $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.');
}