You are here

public function LingotekContentTypeBulkTranslationTest::testRequestTranslationWithActionWithAnError in Lingotek Translation 3.6.x

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

Tests that we manage errors when using the request translation action.

File

tests/src/Functional/LingotekContentTypeBulkTranslationTest.php, line 1242

Class

LingotekContentTypeBulkTranslationTest
Tests translating a config entity using the bulk management form.

Namespace

Drupal\Tests\lingotek\Functional

Code

public function testRequestTranslationWithActionWithAnError() {
  \Drupal::state()
    ->set('lingotek.must_error_in_request_translation', TRUE);
  $this
    ->goToConfigBulkManagementForm('node_type');

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

  // I can check current status.
  $this
    ->assertLingotekCheckSourceStatusLink();

  // I can request a translation
  $this
    ->assertLingotekRequestTranslationLink('es_MX');
  $this
    ->assertTargetStatus('ES', Lingotek::STATUS_REQUEST);
  $edit = [
    $key => TRUE,
    $this
      ->getBulkOperationFormName() => $this
      ->getBulkOperationNameForRequestTranslation('es', 'node'),
  ];
  $this
    ->drupalPostForm(NULL, $edit, $this
    ->getApplyActionsButtonLabel());

  // We failed at requesting a translation, but we don't know what happened.
  // So we don't mark as error but keep it on request.
  $this
    ->assertTargetStatus('ES', Lingotek::STATUS_REQUEST);
  $this
    ->assertText('Document node_type Article es_MX translation request failed. Please try again.');
}