You are here

public function LingotekSystemSiteBulkTranslationTest::testRequestAllTranslationsWithActionWithADocumentArchivedError in Lingotek Translation 3.6.x

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

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

File

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

Class

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

Namespace

Drupal\Tests\lingotek\Functional

Code

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