You are here

public function LingotekSystemSiteBulkTranslationTest::testRequestTranslationWithADocumentNotFoundError 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::testRequestTranslationWithADocumentNotFoundError()
  2. 3.7.x tests/src/Functional/LingotekSystemSiteBulkTranslationTest.php \Drupal\Tests\lingotek\Functional\LingotekSystemSiteBulkTranslationTest::testRequestTranslationWithADocumentNotFoundError()

Tests that we manage errors when using the request translation link.

File

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

Class

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

Namespace

Drupal\Tests\lingotek\Functional

Code

public function testRequestTranslationWithADocumentNotFoundError() {
  \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);
  $this
    ->clickLink('ES');

  // 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.');
}