You are here

public function LingotekEntityTestBulkTranslationTest::testCheckSourceStatusNotCompleted in Lingotek Translation 3.6.x

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

Tests that all the statuses are set when using the Check Translations action.

File

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

Class

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

Namespace

Drupal\Tests\lingotek\Functional

Code

public function testCheckSourceStatusNotCompleted() {

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

  // The document has not been imported yet.
  \Drupal::state()
    ->set('lingotek.document_status_completion', FALSE);
  $key = $this
    ->getBulkSelectionKey('en', 1);
  $edit = [
    $key => TRUE,
    $this
      ->getBulkOperationFormName() => $this
      ->getBulkOperationNameForCheckUpload('entity_test_mul'),
  ];
  $this
    ->drupalPostForm(NULL, $edit, $this
    ->getApplyActionsButtonLabel());

  // I can check current status, because it wasn't imported but it's not marked
  // as an error.
  $this
    ->assertLingotekCheckSourceStatusLink('dummy-document-hash-id', 'entity_test_mul');

  // Check again, it succeeds.
  \Drupal::state()
    ->set('lingotek.document_status_completion', TRUE);
  $key = $this
    ->getBulkSelectionKey('en', 1);
  $edit = [
    $key => TRUE,
    $this
      ->getBulkOperationFormName() => $this
      ->getBulkOperationNameForCheckUpload('entity_test_mul'),
  ];
  $this
    ->drupalPostForm(NULL, $edit, $this
    ->getApplyActionsButtonLabel());

  // Assert that targets can be requested.
  $this
    ->assertLingotekRequestTranslationLink('es_MX', 'dummy-document-hash-id', 'entity_test_mul');
}