public function LingotekNodeBulkTranslationTest::testRequestTranslationWithActionWhenLanguageDisabled in Lingotek Translation 3.8.x
Same name and namespace in other branches
- 4.0.x tests/src/Functional/LingotekNodeBulkTranslationTest.php \Drupal\Tests\lingotek\Functional\LingotekNodeBulkTranslationTest::testRequestTranslationWithActionWhenLanguageDisabled()
Tests that we manage errors when using the request translation action.
1 method overrides LingotekNodeBulkTranslationTest::testRequestTranslationWithActionWhenLanguageDisabled()
- LingotekNodeBulkViewsTranslationTest::testRequestTranslationWithActionWhenLanguageDisabled in tests/
src/ Functional/ Views/ LingotekNodeBulkViewsTranslationTest.php - Tests that we manage errors when using the request translation action.
File
- tests/
src/ Functional/ LingotekNodeBulkTranslationTest.php, line 3734
Class
- LingotekNodeBulkTranslationTest
- Tests translating a node using the bulk management form.
Namespace
Drupal\Tests\lingotek\FunctionalCode
public function testRequestTranslationWithActionWhenLanguageDisabled() {
// Add a language.
$italian = ConfigurableLanguage::createFromLangcode('it');
$italian
->save();
/** @var \Drupal\lingotek\LingotekConfigurationServiceInterface $lingotek_config */
$lingotek_config = \Drupal::service('lingotek.configuration');
$lingotek_config
->disableLanguage($italian);
// Create a node.
$edit = [];
$edit['title[0][value]'] = 'Llamas are cool';
$edit['body[0][value]'] = 'Llamas are very cool';
$edit['langcode[0][value]'] = 'en';
$edit['lingotek_translation_management[lingotek_translation_profile]'] = 'manual';
$this
->saveAndPublishNodeForm($edit);
$this
->goToContentBulkManagementForm();
// I can init the upload of content.
$this
->assertLingotekUploadLink();
$key = $this
->getBulkSelectionKey('en', 1);
$edit = [
$key => TRUE,
$this
->getBulkOperationFormName() => $this
->getBulkOperationNameForUpload('node'),
];
$this
->drupalPostForm(NULL, $edit, $this
->getApplyActionsButtonLabel());
$this
->assertIdentical('en_US', \Drupal::state()
->get('lingotek.uploaded_locale'));
// I can check current status.
$this
->assertLingotekCheckSourceStatusLink();
// I can request a translation
$this
->assertLingotekRequestTranslationLink('es_MX');
$this
->assertTargetStatus('ES', Lingotek::STATUS_REQUEST);
// There is no option for requesting a disabled language.
$this
->assertSession()
->optionNotExists('edit-operation', 'Request Italian (it) translation');
}