public function LingotekFieldBodyTranslationTest::testUploadingWithAnErrorViaAutomaticUpload in Lingotek Translation 3.3.x
Same name and namespace in other branches
- 8.2 tests/src/Functional/LingotekFieldBodyTranslationTest.php \Drupal\Tests\lingotek\Functional\LingotekFieldBodyTranslationTest::testUploadingWithAnErrorViaAutomaticUpload()
- 4.0.x tests/src/Functional/LingotekFieldBodyTranslationTest.php \Drupal\Tests\lingotek\Functional\LingotekFieldBodyTranslationTest::testUploadingWithAnErrorViaAutomaticUpload()
- 3.0.x tests/src/Functional/LingotekFieldBodyTranslationTest.php \Drupal\Tests\lingotek\Functional\LingotekFieldBodyTranslationTest::testUploadingWithAnErrorViaAutomaticUpload()
- 3.1.x tests/src/Functional/LingotekFieldBodyTranslationTest.php \Drupal\Tests\lingotek\Functional\LingotekFieldBodyTranslationTest::testUploadingWithAnErrorViaAutomaticUpload()
- 3.2.x tests/src/Functional/LingotekFieldBodyTranslationTest.php \Drupal\Tests\lingotek\Functional\LingotekFieldBodyTranslationTest::testUploadingWithAnErrorViaAutomaticUpload()
- 3.4.x tests/src/Functional/LingotekFieldBodyTranslationTest.php \Drupal\Tests\lingotek\Functional\LingotekFieldBodyTranslationTest::testUploadingWithAnErrorViaAutomaticUpload()
- 3.5.x tests/src/Functional/LingotekFieldBodyTranslationTest.php \Drupal\Tests\lingotek\Functional\LingotekFieldBodyTranslationTest::testUploadingWithAnErrorViaAutomaticUpload()
- 3.6.x tests/src/Functional/LingotekFieldBodyTranslationTest.php \Drupal\Tests\lingotek\Functional\LingotekFieldBodyTranslationTest::testUploadingWithAnErrorViaAutomaticUpload()
- 3.7.x tests/src/Functional/LingotekFieldBodyTranslationTest.php \Drupal\Tests\lingotek\Functional\LingotekFieldBodyTranslationTest::testUploadingWithAnErrorViaAutomaticUpload()
- 3.8.x tests/src/Functional/LingotekFieldBodyTranslationTest.php \Drupal\Tests\lingotek\Functional\LingotekFieldBodyTranslationTest::testUploadingWithAnErrorViaAutomaticUpload()
Test that we handle errors in upload.
File
- tests/
src/ Functional/ LingotekFieldBodyTranslationTest.php, line 589
Class
- LingotekFieldBodyTranslationTest
- Tests translating a field.
Namespace
Drupal\Tests\lingotek\FunctionalCode
public function testUploadingWithAnErrorViaAutomaticUpload() {
\Drupal::state()
->set('lingotek.must_error_in_upload', TRUE);
$this
->drupalGet('admin/lingotek/settings');
// Create a field.
$edit = [
'label' => 'Excerpt',
'new_storage_type' => 'text',
'field_name' => 'excerpt',
];
$this
->drupalPostForm('/admin/structure/types/manage/article/fields/add-field', $edit, 'Save and continue');
// The document was uploaded automatically and failed.
$this
->assertText('The upload for field_config Excerpt failed. Please try again.');
// The field has been marked with the error status.
$fieldConfig = FieldConfig::load('node.article.field_excerpt');
/** @var \Drupal\lingotek\LingotekConfigTranslationServiceInterface $translation_service */
$translation_service = \Drupal::service('lingotek.config_translation');
$source_status = $translation_service
->getSourceStatus($fieldConfig);
$this
->assertEqual(Lingotek::STATUS_ERROR, $source_status, 'The field has been marked as error.');
}