You are here

public function LingotekNodeBulkTranslationTest::testNodeTranslationUsingActionsForMultipleLocalesAfterEditing in Lingotek Translation 3.4.x

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

Tests that a node can be translated using the actions on the management page for multiple locales after editing it.

File

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

Class

LingotekNodeBulkTranslationTest
Tests translating a node using the bulk management form.

Namespace

Drupal\Tests\lingotek\Functional

Code

public function testNodeTranslationUsingActionsForMultipleLocalesAfterEditing() {
  $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');

  // 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());

  // Download all translations.
  $this
    ->assertLingotekDownloadTargetLink('de_AT', 'dummy-document-hash-id-1');
  $this
    ->assertLingotekDownloadTargetLink('es_MX', 'dummy-document-hash-id-1');
  $key = $this
    ->getBulkSelectionKey('en', 1);
  $edit = [
    $key => TRUE,
    $this
      ->getBulkOperationFormName() => $this
      ->getBulkOperationNameForDownloadTranslations('node'),
  ];
  $this
    ->drupalPostForm(NULL, $edit, $this
    ->getApplyActionsButtonLabel());
  $this
    ->assertIdentical('es_MX', \Drupal::state()
    ->get('lingotek.downloaded_locale'));

  // Now the link is to the workbench, and it opens in a new tab.
  $this
    ->assertLingotekWorkbenchLink('es_MX', 'dummy-document-hash-id-1');
  $this
    ->assertLingotekWorkbenchLink('de_AT', 'dummy-document-hash-id-1');
}