You are here

public function LingotekContentTypeTranslationTest::testUpdatingWithAnErrorViaAutomaticUpload in Lingotek Translation 3.5.x

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

Test that we handle errors in upload.

File

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

Class

LingotekContentTypeTranslationTest
Tests translating a content type.

Namespace

Drupal\Tests\lingotek\Functional

Code

public function testUpdatingWithAnErrorViaAutomaticUpload() {

  // Create a content type.
  $edit = [
    'name' => 'Landing Page',
    'type' => 'landing_page',
  ];
  $this
    ->drupalPostForm('admin/structure/types/add', $edit, 'Save content type');
  \Drupal::state()
    ->set('lingotek.must_error_in_upload', TRUE);

  // Edit the content type.
  $edit['name'] = 'Landing Page EDITED';
  $this
    ->drupalPostForm('/admin/structure/types/manage/landing_page', $edit, t('Save content type'));

  // The document was updated automatically and failed.
  $this
    ->assertText('The update for node_type Landing Page EDITED 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.');
}