You are here

public function LingotekNodeTranslationTest::testUploadingWithAPaymentRequiredErrorViaAutomaticUpload in Lingotek Translation 3.6.x

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

Test that we handle errors in upload.

File

tests/src/Functional/LingotekNodeTranslationTest.php, line 893

Class

LingotekNodeTranslationTest
Tests translating a node.

Namespace

Drupal\Tests\lingotek\Functional

Code

public function testUploadingWithAPaymentRequiredErrorViaAutomaticUpload() {
  \Drupal::state()
    ->set('lingotek.must_payment_required_error_in_upload', TRUE);

  // 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]'] = 'automatic';
  $this
    ->saveAndPublishNodeForm($edit);

  // The document was uploaded automatically and failed.
  $this
    ->assertText('Community has been disabled. Please contact support@lingotek.com to re-enable your community.');

  // The node has been marked with the error status.
  $this->node = Node::load(1);

  /** @var \Drupal\lingotek\LingotekContentTranslationServiceInterface $translation_service */
  $translation_service = \Drupal::service('lingotek.content_translation');
  $source_status = $translation_service
    ->getSourceStatus($this->node);
  $this
    ->assertEqual(Lingotek::STATUS_ERROR, $source_status, 'The node has been marked as error.');
}