You are here

public function LingotekSystemSiteBulkTranslationTest::testRequestTranslationWithActionWithADocumentArchivedError in Lingotek Translation 3.1.x

Same name and namespace in other branches
  1. 8.2 tests/src/Functional/LingotekSystemSiteBulkTranslationTest.php \Drupal\Tests\lingotek\Functional\LingotekSystemSiteBulkTranslationTest::testRequestTranslationWithActionWithADocumentArchivedError()
  2. 4.0.x tests/src/Functional/LingotekSystemSiteBulkTranslationTest.php \Drupal\Tests\lingotek\Functional\LingotekSystemSiteBulkTranslationTest::testRequestTranslationWithActionWithADocumentArchivedError()
  3. 3.0.x tests/src/Functional/LingotekSystemSiteBulkTranslationTest.php \Drupal\Tests\lingotek\Functional\LingotekSystemSiteBulkTranslationTest::testRequestTranslationWithActionWithADocumentArchivedError()
  4. 3.2.x tests/src/Functional/LingotekSystemSiteBulkTranslationTest.php \Drupal\Tests\lingotek\Functional\LingotekSystemSiteBulkTranslationTest::testRequestTranslationWithActionWithADocumentArchivedError()
  5. 3.3.x tests/src/Functional/LingotekSystemSiteBulkTranslationTest.php \Drupal\Tests\lingotek\Functional\LingotekSystemSiteBulkTranslationTest::testRequestTranslationWithActionWithADocumentArchivedError()
  6. 3.4.x tests/src/Functional/LingotekSystemSiteBulkTranslationTest.php \Drupal\Tests\lingotek\Functional\LingotekSystemSiteBulkTranslationTest::testRequestTranslationWithActionWithADocumentArchivedError()
  7. 3.5.x tests/src/Functional/LingotekSystemSiteBulkTranslationTest.php \Drupal\Tests\lingotek\Functional\LingotekSystemSiteBulkTranslationTest::testRequestTranslationWithActionWithADocumentArchivedError()
  8. 3.6.x tests/src/Functional/LingotekSystemSiteBulkTranslationTest.php \Drupal\Tests\lingotek\Functional\LingotekSystemSiteBulkTranslationTest::testRequestTranslationWithActionWithADocumentArchivedError()
  9. 3.7.x tests/src/Functional/LingotekSystemSiteBulkTranslationTest.php \Drupal\Tests\lingotek\Functional\LingotekSystemSiteBulkTranslationTest::testRequestTranslationWithActionWithADocumentArchivedError()
  10. 3.8.x tests/src/Functional/LingotekSystemSiteBulkTranslationTest.php \Drupal\Tests\lingotek\Functional\LingotekSystemSiteBulkTranslationTest::testRequestTranslationWithActionWithADocumentArchivedError()

Tests that we manage errors when using the request translation 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 testRequestTranslationWithActionWithADocumentArchivedError() {
  \Drupal::state()
    ->set('lingotek.must_document_archived_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 this as there are 4 elements by default with that status.
  // $this->assertSourceStatus('EN', Lingotek::STATUS_UNTRACKED);
  $source_error = $this
    ->xpath("//span[contains(@class,'language-icon') and contains(@class,'source-untracked')  and ./a[contains(text(), 'EN')]]");
  $this
    ->assertEqual(count($source_error), 4, 'The system information has been marked as untracked.');
  $this
    ->assertNoLingotekRequestTranslationLink('es_MX');
  $this
    ->assertText('Document System information has been archived. Please upload again.');
}