You are here

public function LingotekContentTypeTranslationTest::testUploadingWithAnErrorViaAutomaticUpload 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::testUploadingWithAnErrorViaAutomaticUpload()
  2. 4.0.x tests/src/Functional/LingotekContentTypeTranslationTest.php \Drupal\Tests\lingotek\Functional\LingotekContentTypeTranslationTest::testUploadingWithAnErrorViaAutomaticUpload()
  3. 3.0.x tests/src/Functional/LingotekContentTypeTranslationTest.php \Drupal\Tests\lingotek\Functional\LingotekContentTypeTranslationTest::testUploadingWithAnErrorViaAutomaticUpload()
  4. 3.1.x tests/src/Functional/LingotekContentTypeTranslationTest.php \Drupal\Tests\lingotek\Functional\LingotekContentTypeTranslationTest::testUploadingWithAnErrorViaAutomaticUpload()
  5. 3.2.x tests/src/Functional/LingotekContentTypeTranslationTest.php \Drupal\Tests\lingotek\Functional\LingotekContentTypeTranslationTest::testUploadingWithAnErrorViaAutomaticUpload()
  6. 3.3.x tests/src/Functional/LingotekContentTypeTranslationTest.php \Drupal\Tests\lingotek\Functional\LingotekContentTypeTranslationTest::testUploadingWithAnErrorViaAutomaticUpload()
  7. 3.4.x tests/src/Functional/LingotekContentTypeTranslationTest.php \Drupal\Tests\lingotek\Functional\LingotekContentTypeTranslationTest::testUploadingWithAnErrorViaAutomaticUpload()
  8. 3.5.x tests/src/Functional/LingotekContentTypeTranslationTest.php \Drupal\Tests\lingotek\Functional\LingotekContentTypeTranslationTest::testUploadingWithAnErrorViaAutomaticUpload()
  9. 3.7.x tests/src/Functional/LingotekContentTypeTranslationTest.php \Drupal\Tests\lingotek\Functional\LingotekContentTypeTranslationTest::testUploadingWithAnErrorViaAutomaticUpload()
  10. 3.8.x tests/src/Functional/LingotekContentTypeTranslationTest.php \Drupal\Tests\lingotek\Functional\LingotekContentTypeTranslationTest::testUploadingWithAnErrorViaAutomaticUpload()

Test that we handle errors in upload.

File

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

Class

LingotekContentTypeTranslationTest
Tests translating a content type.

Namespace

Drupal\Tests\lingotek\Functional

Code

public function testUploadingWithAnErrorViaAutomaticUpload() {
  $this
    ->saveLingotekConfigTranslationSettings([
    'node_type' => 'automatic',
  ]);
  \Drupal::state()
    ->set('lingotek.must_error_in_upload', TRUE);
  $this
    ->drupalGet('admin/lingotek/settings');

  // 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('The upload for node_type Landing Page failed. Please try again.');

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