You are here

public function LingotekNodeBulkTranslationTest::testNodeTranslationUsingActionsForMultipleLocalesAfterEditingWithPendingPhases in Lingotek Translation 3.5.x

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

File

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

Class

LingotekNodeBulkTranslationTest
Tests translating a node using the bulk management form.

Namespace

Drupal\Tests\lingotek\Functional

Code

public function testNodeTranslationUsingActionsForMultipleLocalesAfterEditingWithPendingPhases() {
  $this
    ->testNodeTranslationUsingActionsForMultipleLocales();

  // Edit the node.
  $edit = [];
  $edit['title[0][value]'] = 'Llamas are cool EDITED';
  $this
    ->saveAndKeepPublishedThisTranslationNodeForm($edit, 1);
  $this
    ->goToContentBulkManagementForm();

  // Let's upload the edited content so it's updated and downloadable.
  $this
    ->clickLink('EN');

  // Check the source status is current.
  $this
    ->clickLink('EN');

  // Ensure we won't get a completed document because there are phases pending.
  \Drupal::state()
    ->set('lingotek.document_completion', FALSE);

  // Check all statuses, after being edited and the source re-uploaded
  // Should be in STATUS_PENDING
  $this
    ->assertLingotekCheckTargetStatusLink('de_AT', 'dummy-document-hash-id-1');
  $this
    ->assertLingotekCheckTargetStatusLink('es_MX', 'dummy-document-hash-id-1');
  $key = $this
    ->getBulkSelectionKey('en', 1);
  $edit = [
    $key => TRUE,
    $this
      ->getBulkOperationFormName() => $this
      ->getBulkOperationNameForCheckTranslations('node'),
  ];
  $this
    ->drupalPostForm(NULL, $edit, $this
    ->getApplyActionsButtonLabel());

  // Ensure that the statuses are set to PENDING since the source has been
  // reuploaded and the targets are being translated. It is possible that
  // some of the translation is finished and could be downloaded, but that
  // should be marked as STATUS_READY_INTERIM but that has not been
  // implemented yet.
  // TODO: update test to check that status is STATUS_READY_INTERIM and then
  // they can be downloaded and then the status is set to STATUS_INTERMEDIATE
  // see ticket: https://www.drupal.org/node/2850548
  // Check the status is PENDING for Spanish and German.
  $this
    ->assertTargetStatus('DE', 'pending');
  $this
    ->assertTargetStatus('ES', 'pending');
}