You are here

public function LingotekNodeBulkTranslationTest::testNodeMultipleLanguageTranslationUsingActions in Lingotek Translation 3.3.x

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

Tests that a node can be translated using the actions on the management page.

File

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

Class

LingotekNodeBulkTranslationTest
Tests translating a node using the bulk management form.

Namespace

Drupal\Tests\lingotek\Functional

Code

public function testNodeMultipleLanguageTranslationUsingActions() {

  // Login as admin.
  $this
    ->drupalLogin($this->rootUser);

  // Add a language.
  ConfigurableLanguage::createFromLangcode('de')
    ->setThirdPartySetting('lingotek', 'locale', 'de_AT')
    ->save();

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

  // Create another node.
  $edit = [];
  $edit['title[0][value]'] = 'Llamas are cool 2';
  $edit['body[0][value]'] = 'Llamas are very cool 2';
  $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(1);
  $this
    ->assertLingotekUploadLink(2);
  $key1 = $this
    ->getBulkSelectionKey('en', 1);
  $key2 = $this
    ->getBulkSelectionKey('en', 2);
  $edit = [
    $key1 => TRUE,
    $key2 => TRUE,
    $this
      ->getBulkOperationFormName() => $this
      ->getBulkOperationNameForUpload('node'),
  ];
  $this
    ->drupalPostForm(NULL, $edit, $this
    ->getApplyActionsButtonLabel());

  // I can check current status.
  $this
    ->assertLingotekCheckSourceStatusLink('dummy-document-hash-id');
  $this
    ->assertLingotekCheckSourceStatusLink('dummy-document-hash-id-1');
  $edit = [
    $key1 => TRUE,
    $key2 => TRUE,
    $this
      ->getBulkOperationFormName() => $this
      ->getBulkOperationNameForCheckUpload('node'),
  ];
  $this
    ->drupalPostForm(NULL, $edit, $this
    ->getApplyActionsButtonLabel());

  // Request all the translations.
  $this
    ->assertLingotekRequestTranslationLink('de_AT', 'dummy-document-hash-id');
  $this
    ->assertLingotekRequestTranslationLink('es_MX', 'dummy-document-hash-id');
  $this
    ->assertLingotekRequestTranslationLink('de_AT', 'dummy-document-hash-id-1');
  $this
    ->assertLingotekRequestTranslationLink('es_MX', 'dummy-document-hash-id-1');
  $edit = [
    $key1 => TRUE,
    $key2 => TRUE,
    $this
      ->getBulkOperationFormName() => $this
      ->getBulkOperationNameForRequestTranslations('node'),
  ];
  $this
    ->drupalPostForm(NULL, $edit, $this
    ->getApplyActionsButtonLabel());

  // Check status of all the translations.
  $this
    ->assertLingotekCheckTargetStatusLink('de_AT', 'dummy-document-hash-id');
  $this
    ->assertLingotekCheckTargetStatusLink('es_MX', 'dummy-document-hash-id');
  $this
    ->assertLingotekCheckTargetStatusLink('de_AT', 'dummy-document-hash-id-1');
  $this
    ->assertLingotekCheckTargetStatusLink('es_MX', 'dummy-document-hash-id-1');
  $edit = [
    $key1 => TRUE,
    $key2 => TRUE,
    $this
      ->getBulkOperationFormName() => $this
      ->getBulkOperationNameForCheckTranslations('node'),
  ];
  $this
    ->drupalPostForm(NULL, $edit, $this
    ->getApplyActionsButtonLabel());

  // Download all the translations.
  $this
    ->assertLingotekDownloadTargetLink('de_AT', 'dummy-document-hash-id');
  $this
    ->assertLingotekDownloadTargetLink('es_MX', 'dummy-document-hash-id');
  $this
    ->assertLingotekDownloadTargetLink('de_AT', 'dummy-document-hash-id-1');
  $this
    ->assertLingotekDownloadTargetLink('es_MX', 'dummy-document-hash-id-1');
  $edit = [
    $key1 => TRUE,
    $key2 => TRUE,
    $this
      ->getBulkOperationFormName() => $this
      ->getBulkOperationNameForDownloadTranslations('node'),
  ];
  $this
    ->drupalPostForm(NULL, $edit, $this
    ->getApplyActionsButtonLabel());
}