You are here

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

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

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

File

tests/src/Functional/LingotekNodeBulkTranslationTest.php, line 2130

Class

LingotekNodeBulkTranslationTest
Tests translating a node 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);

  // Create a node.
  $edit = [];
  $edit['title[0][value]'] = 'Llamas are cool';
  $edit['body[0][value]'] = 'Llamas are very cool';
  $edit['langcode[0][value]'] = 'en';
  $edit['lingotek_translation_management[lingotek_translation_profile]'] = 'manual';
  $this
    ->saveAndPublishNodeForm($edit);
  $this
    ->goToContentBulkManagementForm();

  // I can init the upload of content.
  $this
    ->assertLingotekUploadLink();
  $key = $this
    ->getBulkSelectionKey('en', 1);
  $edit = [
    $key => TRUE,
    $this
      ->getBulkOperationFormName() => $this
      ->getBulkOperationNameForUpload('node'),
  ];
  $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('node'),
  ];
  $this
    ->drupalPostForm(NULL, $edit, $this
    ->getApplyActionsButtonLabel());
  $this
    ->assertSourceStatus('EN', Lingotek::STATUS_UNTRACKED);
  $this
    ->assertNoLingotekRequestTranslationLink('es_MX');
  $this
    ->assertText('Document node Llamas are cool has been archived. Please upload again.');
}