You are here

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

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

Test that we handle errors in upload.

File

tests/src/Functional/LingotekContentTypeTranslationTest.php, line 251

Class

LingotekContentTypeTranslationTest
Tests translating a content type.

Namespace

Drupal\Tests\lingotek\Functional

Code

public function testUploadingWithAPaymentRequiredErrorViaAutomaticUpload() {
  $this
    ->saveLingotekConfigTranslationSettings([
    'node_type' => 'automatic',
  ]);
  \Drupal::state()
    ->set('lingotek.must_payment_required_error_in_upload', TRUE);

  // Create a content type.
  $edit = [
    'name' => 'Landing Page',
    'type' => 'landing_page',
  ];
  $this
    ->drupalPostForm('admin/structure/types/add', $edit, 'Save content type');

  // 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 type has been marked with the error status.
  $nodeType = NodeType::load('landing_page');

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