public function LingotekEntityTestBulkTranslationTest::testTranslationDownloadWithUnrequestedLocales in Lingotek Translation 3.1.x
Same name and namespace in other branches
- 8.2 tests/src/Functional/LingotekEntityTestBulkTranslationTest.php \Drupal\Tests\lingotek\Functional\LingotekEntityTestBulkTranslationTest::testTranslationDownloadWithUnrequestedLocales()
- 4.0.x tests/src/Functional/LingotekEntityTestBulkTranslationTest.php \Drupal\Tests\lingotek\Functional\LingotekEntityTestBulkTranslationTest::testTranslationDownloadWithUnrequestedLocales()
- 3.0.x tests/src/Functional/LingotekEntityTestBulkTranslationTest.php \Drupal\Tests\lingotek\Functional\LingotekEntityTestBulkTranslationTest::testTranslationDownloadWithUnrequestedLocales()
- 3.2.x tests/src/Functional/LingotekEntityTestBulkTranslationTest.php \Drupal\Tests\lingotek\Functional\LingotekEntityTestBulkTranslationTest::testTranslationDownloadWithUnrequestedLocales()
- 3.3.x tests/src/Functional/LingotekEntityTestBulkTranslationTest.php \Drupal\Tests\lingotek\Functional\LingotekEntityTestBulkTranslationTest::testTranslationDownloadWithUnrequestedLocales()
- 3.4.x tests/src/Functional/LingotekEntityTestBulkTranslationTest.php \Drupal\Tests\lingotek\Functional\LingotekEntityTestBulkTranslationTest::testTranslationDownloadWithUnrequestedLocales()
- 3.5.x tests/src/Functional/LingotekEntityTestBulkTranslationTest.php \Drupal\Tests\lingotek\Functional\LingotekEntityTestBulkTranslationTest::testTranslationDownloadWithUnrequestedLocales()
- 3.6.x tests/src/Functional/LingotekEntityTestBulkTranslationTest.php \Drupal\Tests\lingotek\Functional\LingotekEntityTestBulkTranslationTest::testTranslationDownloadWithUnrequestedLocales()
- 3.7.x tests/src/Functional/LingotekEntityTestBulkTranslationTest.php \Drupal\Tests\lingotek\Functional\LingotekEntityTestBulkTranslationTest::testTranslationDownloadWithUnrequestedLocales()
- 3.8.x tests/src/Functional/LingotekEntityTestBulkTranslationTest.php \Drupal\Tests\lingotek\Functional\LingotekEntityTestBulkTranslationTest::testTranslationDownloadWithUnrequestedLocales()
Tests that unrequested locales are not marked as error when downloading all.
File
- tests/
src/ Functional/ LingotekEntityTestBulkTranslationTest.php, line 343
Class
- LingotekEntityTestBulkTranslationTest
- Tests translating the entity test using the bulk management form.
Namespace
Drupal\Tests\lingotek\FunctionalCode
public function testTranslationDownloadWithUnrequestedLocales() {
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');
$basepath = \Drupal::request()
->getBasePath();
// 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'));
// 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.');
// 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());
// The translations not requested shouldn't change its status.
$this
->assertLingotekRequestTranslationLink('de_DE', 'dummy-document-hash-id', 'entity_test_mul');
$this
->assertLingotekRequestTranslationLink('it_IT', 'dummy-document-hash-id', 'entity_test_mul');
// They aren't marked as error.
$this
->assertNoTargetError('Llamas are cool', 'DE', 'de_DE');
$this
->assertNoTargetError('Llamas are cool', 'IT', 'it_IT');
}