You are here

public function LingotekEntityTestBulkTranslationTest::testEntityTestTranslationUsingActions in Lingotek Translation 3.3.x

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

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

File

tests/src/Functional/LingotekEntityTestBulkTranslationTest.php, line 124

Class

LingotekEntityTestBulkTranslationTest
Tests translating the entity test using the bulk management form.

Namespace

Drupal\Tests\lingotek\Functional

Code

public function testEntityTestTranslationUsingActions() {

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

  // Create a entity_test_mul.
  $edit = [];
  $edit['name[0][value]'] = 'Llamas are cool';
  $edit['field_test_text[0][value]'] = 'Llamas are very cool';
  $edit['langcode[0][value]'] = 'en';
  $edit['lingotek_translation_management[lingotek_translation_profile]'] = 'manual';
  $this
    ->drupalPostForm('/entity_test_mul/add/entity_test_mul', $edit, t('Save'));
  $this
    ->goToContentBulkManagementForm('entity_test_mul');

  // I can init the upload of content.
  $this
    ->assertLingotekUploadLink(1, 'entity_test_mul');
  $key = $this
    ->getBulkSelectionKey('en', 1);
  $edit = [
    $key => TRUE,
    $this
      ->getBulkOperationFormName() => $this
      ->getBulkOperationNameForUpload('entity_test_mul'),
  ];
  $this
    ->drupalPostForm(NULL, $edit, $this
    ->getApplyActionsButtonLabel());
  $this
    ->assertIdentical('en_US', \Drupal::state()
    ->get('lingotek.uploaded_locale'));

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

  // Request the German (AT) translation.
  $this
    ->assertLingotekRequestTranslationLink('de_AT', 'dummy-document-hash-id', 'entity_test_mul');
  $key = $this
    ->getBulkSelectionKey('en', 1);
  $edit = [
    $key => TRUE,
    $this
      ->getBulkOperationFormName() => $this
      ->getBulkOperationNameForRequestTranslation('de', 'entity_test_mul'),
  ];
  $this
    ->drupalPostForm(NULL, $edit, $this
    ->getApplyActionsButtonLabel());
  $this
    ->assertIdentical('de_AT', \Drupal::state()
    ->get('lingotek.added_target_locale'));

  // Check status of the German (AT) translation.
  $this
    ->assertLingotekCheckTargetStatusLink('de_AT', 'dummy-document-hash-id', 'entity_test_mul');
  $key = $this
    ->getBulkSelectionKey('en', 1);
  $edit = [
    $key => TRUE,
    $this
      ->getBulkOperationFormName() => 'check_translation:de',
  ];
  $this
    ->drupalPostForm(NULL, $edit, $this
    ->getApplyActionsButtonLabel());
  $this
    ->assertIdentical('de_AT', \Drupal::state()
    ->get('lingotek.checked_target_locale'));

  // Download the German (AT) translation.
  $this
    ->assertLingotekDownloadTargetLink('de_AT', 'dummy-document-hash-id', 'entity_test_mul');
  $key = $this
    ->getBulkSelectionKey('en', 1);
  $edit = [
    $key => TRUE,
    $this
      ->getBulkOperationFormName() => 'download:de',
  ];
  $this
    ->drupalPostForm(NULL, $edit, $this
    ->getApplyActionsButtonLabel());
  $this
    ->assertIdentical('de_AT', \Drupal::state()
    ->get('lingotek.downloaded_locale'));

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