public function LingotekEntityTestBulkTranslationTest::testCheckTranslationsWithDownloadedLocales in Lingotek Translation 4.0.x
Same name and namespace in other branches
- 8.2 tests/src/Functional/LingotekEntityTestBulkTranslationTest.php \Drupal\Tests\lingotek\Functional\LingotekEntityTestBulkTranslationTest::testCheckTranslationsWithDownloadedLocales()
- 3.0.x tests/src/Functional/LingotekEntityTestBulkTranslationTest.php \Drupal\Tests\lingotek\Functional\LingotekEntityTestBulkTranslationTest::testCheckTranslationsWithDownloadedLocales()
- 3.1.x tests/src/Functional/LingotekEntityTestBulkTranslationTest.php \Drupal\Tests\lingotek\Functional\LingotekEntityTestBulkTranslationTest::testCheckTranslationsWithDownloadedLocales()
- 3.2.x tests/src/Functional/LingotekEntityTestBulkTranslationTest.php \Drupal\Tests\lingotek\Functional\LingotekEntityTestBulkTranslationTest::testCheckTranslationsWithDownloadedLocales()
- 3.3.x tests/src/Functional/LingotekEntityTestBulkTranslationTest.php \Drupal\Tests\lingotek\Functional\LingotekEntityTestBulkTranslationTest::testCheckTranslationsWithDownloadedLocales()
- 3.4.x tests/src/Functional/LingotekEntityTestBulkTranslationTest.php \Drupal\Tests\lingotek\Functional\LingotekEntityTestBulkTranslationTest::testCheckTranslationsWithDownloadedLocales()
- 3.5.x tests/src/Functional/LingotekEntityTestBulkTranslationTest.php \Drupal\Tests\lingotek\Functional\LingotekEntityTestBulkTranslationTest::testCheckTranslationsWithDownloadedLocales()
- 3.6.x tests/src/Functional/LingotekEntityTestBulkTranslationTest.php \Drupal\Tests\lingotek\Functional\LingotekEntityTestBulkTranslationTest::testCheckTranslationsWithDownloadedLocales()
- 3.7.x tests/src/Functional/LingotekEntityTestBulkTranslationTest.php \Drupal\Tests\lingotek\Functional\LingotekEntityTestBulkTranslationTest::testCheckTranslationsWithDownloadedLocales()
- 3.8.x tests/src/Functional/LingotekEntityTestBulkTranslationTest.php \Drupal\Tests\lingotek\Functional\LingotekEntityTestBulkTranslationTest::testCheckTranslationsWithDownloadedLocales()
Tests that current locales are not cleared when checking statuses.
File
- tests/
src/ Functional/ LingotekEntityTestBulkTranslationTest.php, line 411
Class
- LingotekEntityTestBulkTranslationTest
- Tests translating the entity test using the bulk management form.
Namespace
Drupal\Tests\lingotek\FunctionalCode
public function testCheckTranslationsWithDownloadedLocales() {
ConfigurableLanguage::createFromLangcode('de')
->setThirdPartySetting('lingotek', 'locale', 'de_DE')
->save();
ConfigurableLanguage::createFromLangcode('it')
->setThirdPartySetting('lingotek', 'locale', 'it_IT')
->save();
// Create a entity_test_mul.
$edit = [];
$edit['name[0][value]'] = 'Llamas are cool';
$edit['field_test_text[0][value]'] = 'Llamas are very cool';
$edit['langcode[0][value]'] = 'en';
$edit['lingotek_translation_management[lingotek_translation_profile]'] = 'manual';
$this
->drupalPostForm('/entity_test_mul/add/entity_test_mul', $edit, t('Save'));
$this
->goToContentBulkManagementForm('entity_test_mul');
// I can init the upload of content.
$this
->assertLingotekUploadLink(1, 'entity_test_mul');
$key = $this
->getBulkSelectionKey('en', 1);
$edit = [
$key => TRUE,
$this
->getBulkOperationFormName() => $this
->getBulkOperationNameForUpload('entity_test_mul'),
];
$this
->drupalPostForm(NULL, $edit, $this
->getApplyActionsButtonLabel());
$this
->assertIdentical('en_US', \Drupal::state()
->get('lingotek.uploaded_locale'));
// I can check current status.
$this
->assertLingotekCheckSourceStatusLink('dummy-document-hash-id', 'entity_test_mul');
$key = $this
->getBulkSelectionKey('en', 1);
$edit = [
$key => TRUE,
$this
->getBulkOperationFormName() => $this
->getBulkOperationNameForCheckUpload('entity_test_mul'),
];
$this
->drupalPostForm(NULL, $edit, $this
->getApplyActionsButtonLabel());
// Request the Spanish translation.
$this
->assertLingotekRequestTranslationLink('es_MX', 'dummy-document-hash-id', 'entity_test_mul');
$this
->clickLink('ES');
$this
->assertText("Locale 'es_MX' was added as a translation target for entity_test_mul Llamas are cool.");
$this
->assertIdentical('es_MX', \Drupal::state()
->get('lingotek.added_target_locale'));
\Drupal::state()
->resetCache();
// Request italian.
$this
->assertLingotekRequestTranslationLink('it_IT', 'dummy-document-hash-id', 'entity_test_mul');
$this
->clickLink('IT');
$this
->assertText("Locale 'it_IT' was added as a translation target for entity_test_mul Llamas are cool.");
$this
->assertIdentical('it_IT', \Drupal::state()
->get('lingotek.added_target_locale'));
// Check status of the Spanish translation.
$this
->assertLingotekCheckTargetStatusLink('es_MX', 'dummy-document-hash-id', 'entity_test_mul');
$this
->clickLink('ES');
$this
->assertIdentical('es_MX', \Drupal::state()
->get('lingotek.checked_target_locale'));
$this
->assertText('The es_MX translation for entity_test_mul Llamas are cool is ready for download.');
\Drupal::state()
->resetCache();
// Check status of the Italian translation.
$this
->assertLingotekCheckTargetStatusLink('it_IT', 'dummy-document-hash-id', 'entity_test_mul');
$this
->clickLink('IT');
$this
->assertIdentical('it_IT', \Drupal::state()
->get('lingotek.checked_target_locale'));
$this
->assertText('The it_IT translation for entity_test_mul Llamas are cool is ready for download.');
// Download all the translations.
$this
->assertLingotekDownloadTargetLink('es_MX', 'dummy-document-hash-id', 'entity_test_mul');
$key = $this
->getBulkSelectionKey('en', 1);
$edit = [
$key => TRUE,
$this
->getBulkOperationFormName() => $this
->getBulkOperationNameForDownloadTranslations('entity_test_mul'),
];
$this
->drupalPostForm(NULL, $edit, $this
->getApplyActionsButtonLabel());
// They are marked with the right status.
$this
->assertTargetStatus('ES', 'current');
$this
->assertTargetStatus('IT', 'current');
$this
->assertTargetStatus('DE', 'request');
// We check all translations.
\Drupal::state()
->set('lingotek.document_completion_statuses', [
'es-ES' => 100,
'it-IT' => 100,
]);
$key = $this
->getBulkSelectionKey('en', 1);
$edit = [
$key => TRUE,
$this
->getBulkOperationFormName() => $this
->getBulkOperationNameForCheckTranslations('entity_test_mul'),
];
$this
->drupalPostForm(NULL, $edit, $this
->getApplyActionsButtonLabel());
// And statuses should remain the same.
$this
->assertTargetStatus('ES', 'current');
$this
->assertTargetStatus('IT', 'current');
$this
->assertTargetStatus('DE', 'request');
}